public void Enum_ConnnectionStringDictionary(string conStringA, string conStringB) { var builder = new ContainerBuilder(); var module = new ServForOracleModule <TestEnum>(new Dictionary <TestEnum, string> { { TestEnum.A, conStringA }, { TestEnum.B, conStringB } }); module.LoadInternal(builder); var container = builder.Build(ContainerBuildOptions.ExcludeDefaultModules); Assert.True(container.IsRegisteredWithKey <IServiceForOracle>(TestEnum.A)); Assert.True(container.IsRegisteredWithKey <IDbConnectionFactory>(TestEnum.A)); var serviceA = container.ResolveKeyed <IServiceForOracle>(TestEnum.A); Assert.NotNull(serviceA); Assert.True(container.IsRegisteredWithKey <IServiceForOracle>(TestEnum.B)); Assert.True(container.IsRegisteredWithKey <IDbConnectionFactory>(TestEnum.B)); var serviceB = container.ResolveKeyed <IServiceForOracle>(TestEnum.B); Assert.NotNull(serviceB); }
public void ConnnectionString(string connectionString) { var builder = new ContainerBuilder(); var module = new ServForOracleModule(connectionString); module.LoadInternal(builder); var container = builder.Build(ContainerBuildOptions.ExcludeDefaultModules); Assert.True(container.IsRegistered <IServiceForOracle>()); Assert.True(container.IsRegistered <IDbConnectionFactory>()); var service = container.Resolve <IServiceForOracle>(); Assert.NotNull(service); }
public void ConnnectionStringObjectDictionary(Dictionary <object, string> connectionStrings) { var builder = new ContainerBuilder(); var module = new ServForOracleModule(connectionStrings); module.LoadInternal(builder); var container = builder.Build(ContainerBuildOptions.ExcludeDefaultModules); foreach (var conStr in connectionStrings) { Assert.True(container.IsRegisteredWithKey <IServiceForOracle>(conStr.Key)); Assert.True(container.IsRegisteredWithKey <IDbConnectionFactory>(conStr.Key)); var service = container.ResolveKeyed <IServiceForOracle>(conStr.Key); Assert.NotNull(service); } }