diff --git a/source/Tests/Data.Tests/Configuration/DataAccessTypeRegistrationFixture.cs b/source/Tests/Data.Tests/Configuration/DataAccessTypeRegistrationFixture.cs index 5978cce..f5b19ad 100644 --- a/source/Tests/Data.Tests/Configuration/DataAccessTypeRegistrationFixture.cs +++ b/source/Tests/Data.Tests/Configuration/DataAccessTypeRegistrationFixture.cs @@ -108,11 +108,7 @@ public void Given() oracleSettings.OracleConnectionsData.Add(oracleConnectionData); configurationSource.Add(OracleConnectionSettings.SectionName, oracleSettings); - var dbSettings = new DatabaseSettings(); - DbProviderMapping mapping = new DbProviderMapping(DbProviderMapping.DefaultOracleProviderName, typeof(OracleDatabase)); - dbSettings.ProviderMappings.Add(mapping); - configurationSource.Add(DatabaseSettings.SectionName, dbSettings); - + configurationSource.AddOracleDatabaseProviderMapping(); settings = new DatabaseSyntheticConfigSettings(configurationSource.GetSection); } diff --git a/source/Tests/Data.Tests/Configuration/DatabaseSyntheticConfigurationSettingsFixture.cs b/source/Tests/Data.Tests/Configuration/DatabaseSyntheticConfigurationSettingsFixture.cs index 42eb1a9..dfc2999 100644 --- a/source/Tests/Data.Tests/Configuration/DatabaseSyntheticConfigurationSettingsFixture.cs +++ b/source/Tests/Data.Tests/Configuration/DatabaseSyntheticConfigurationSettingsFixture.cs @@ -420,10 +420,7 @@ public void Setup() configSource.Add("connectionStrings", connectionStrings); - var dbSettings = new DatabaseSettings(); - DbProviderMapping mapping = new DbProviderMapping(DbProviderMapping.DefaultOracleProviderName, typeof(OracleDatabase)); - dbSettings.ProviderMappings.Add(mapping); - configSource.Add(DatabaseSettings.SectionName, dbSettings); + configSource.AddOracleDatabaseProviderMapping(); configSettings = new DatabaseSyntheticConfigSettings(configSource.GetSection); } @@ -459,10 +456,7 @@ public void Setup() var oracleSettings = new OracleConnectionSettings(); configSource.Add(OracleConnectionSettings.SectionName, oracleSettings); - var dbSettings = new DatabaseSettings(); - DbProviderMapping mapping = new DbProviderMapping(DbProviderMapping.DefaultOracleProviderName, typeof(OracleDatabase)); - dbSettings.ProviderMappings.Add(mapping); - configSource.Add(DatabaseSettings.SectionName, dbSettings); + configSource.AddOracleDatabaseProviderMapping(); configSettings = new DatabaseSyntheticConfigSettings(configSource.GetSection); } @@ -501,10 +495,7 @@ public void Setup() oracleSettings.OracleConnectionsData.Add(oracleConnectionData); configSource.Add(OracleConnectionSettings.SectionName, oracleSettings); - var dbSettings = new DatabaseSettings(); - DbProviderMapping mapping = new DbProviderMapping(DbProviderMapping.DefaultOracleProviderName, typeof(OracleDatabase)); - dbSettings.ProviderMappings.Add(mapping); - configSource.Add(DatabaseSettings.SectionName, dbSettings); + configSource.AddOracleDatabaseProviderMapping(); configSettings = new DatabaseSyntheticConfigSettings(configSource.GetSection); } diff --git a/source/Tests/Data.Tests/ConfigurationSourceExtensions.cs b/source/Tests/Data.Tests/ConfigurationSourceExtensions.cs new file mode 100644 index 0000000..0a899aa --- /dev/null +++ b/source/Tests/Data.Tests/ConfigurationSourceExtensions.cs @@ -0,0 +1,18 @@ +using System; +using Microsoft.Practices.EnterpriseLibrary.Common.Configuration; +using Microsoft.Practices.EnterpriseLibrary.Data.Configuration; +using Microsoft.Practices.EnterpriseLibrary.Data.Oracle; + +namespace Microsoft.Practices.EnterpriseLibrary.Data.Tests +{ + internal static class ConfigurationSourceExtensions + { + internal static void AddOracleDatabaseProviderMapping(this IConfigurationSource source) + { + var dbSettings = new DatabaseSettings(); + DbProviderMapping mapping = new DbProviderMapping(DbProviderMapping.DefaultOracleProviderName, typeof(OracleDatabase)); + dbSettings.ProviderMappings.Add(mapping); + source.Add(DatabaseSettings.SectionName, dbSettings); + } + } +}