Skip to content

Commit

Permalink
Test that ODBC database provider is created correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
tsahi committed Jan 2, 2021
1 parent ed5db28 commit 1794a07
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 12 additions & 2 deletions source/Tests/Data.Tests/Configuration/DatabaseFactoryFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

using System.Data.Common;
using System.Data.Odbc;
using System.Data.SqlClient;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Data.Odbc;
using Microsoft.Practices.EnterpriseLibrary.Data.OleDb;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand Down Expand Up @@ -36,13 +38,13 @@ public void CanCreateSqlDatabase()
[TestMethod]
public void CanCreateGenericDatabase()
{
Database database = this.factory.Create("OdbcDatabase");
Database database = this.factory.Create("mapping2");
Assert.IsNotNull(database);
Assert.AreSame(typeof(GenericDatabase), database.GetType());

// provider factories aren't exposed
DbCommand command = database.GetStoredProcCommand("ignore");
Assert.AreSame(typeof(OdbcCommand), command.GetType());
Assert.AreSame(typeof(SqlCommand), command.GetType());
}

[TestMethod]
Expand All @@ -52,5 +54,13 @@ public void CanCreateOleDbDatabase()
Assert.IsNotNull(database);
Assert.AreSame(typeof(OleDbDatabase), database.GetType());
}

[TestMethod]
public void CanCreateOdbcDatabase()
{
Database database = factory.Create("OdbcDatabase");
Assert.IsNotNull(database);
Assert.AreSame(typeof(OdbcDatabase), database.GetType());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
name="System.Data.SqlClient" />
<add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.OleDb.OleDbDatabase, Microsoft.Practices.EnterpriseLibrary.Data.OleDb, Version=6.0.0.0"
name="System.Data.OleDb" />
<add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Odbc.OdbcDatabase, Microsoft.Practices.EnterpriseLibrary.Data.Odbc, Version=6.0.0.0"
name="System.Data.Odbc" />
</providerMappings>
</dataConfiguration>

Expand Down

0 comments on commit 1794a07

Please sign in to comment.