public void Unregistering_not_registered_provider_does_not_throw() { var resolver = new DbProviderServicesResolver(); resolver.Unregister(SqlClientInvariantName); Assert.IsType<LegacyDbProviderServicesWrapper>( resolver.GetService(typeof(DbProviderServices), SqlClientInvariantName)); }
public void Unregistering_not_registered_provider_does_not_throw() { var resolver = new DbProviderServicesResolver(); resolver.Unregister(SqlClientInvariantName); Assert.IsType <LegacyDbProviderServicesWrapper>( resolver.GetService(typeof(DbProviderServices), SqlClientInvariantName)); }
public void Can_register_unregister_provider() { var resolver = new DbProviderServicesResolver(); resolver.Register(typeof(SqlProviderServices), SqlClientInvariantName); Assert.Same( SqlProviderServices.Instance, resolver.GetService(typeof(DbProviderServices), SqlClientInvariantName)); resolver.Unregister(SqlClientInvariantName); Assert.IsType<LegacyDbProviderServicesWrapper>( resolver.GetService(typeof(DbProviderServices), SqlClientInvariantName)); }
public void Can_register_unregister_provider() { var resolver = new DbProviderServicesResolver(); resolver.Register(typeof(SqlProviderServices), SqlClientInvariantName); Assert.Same( SqlProviderServices.Instance, resolver.GetService(typeof(DbProviderServices), SqlClientInvariantName)); resolver.Unregister(SqlClientInvariantName); Assert.IsType <LegacyDbProviderServicesWrapper>( resolver.GetService(typeof(DbProviderServices), SqlClientInvariantName)); }
public void Registering_registered_provider_replaces_provider() { var mockProviderServices = new Mock<DbProviderServices>(); var resolver = new DbProviderServicesResolver(); resolver.Register(mockProviderServices.Object.GetType(), SqlClientInvariantName); resolver.Register(typeof(SqlProviderServices), SqlClientInvariantName); Assert.Same( SqlProviderServices.Instance, resolver.GetService(typeof(DbProviderServices), SqlClientInvariantName)); resolver.Unregister(SqlClientInvariantName); Assert.IsType<LegacyDbProviderServicesWrapper>( resolver.GetService(typeof(DbProviderServices), SqlClientInvariantName)); }
public void Registering_registered_provider_replaces_provider() { var mockProviderServices = new Mock <DbProviderServices>(); var resolver = new DbProviderServicesResolver(); resolver.Register(mockProviderServices.Object.GetType(), SqlClientInvariantName); resolver.Register(typeof(SqlProviderServices), SqlClientInvariantName); Assert.Same( SqlProviderServices.Instance, resolver.GetService(typeof(DbProviderServices), SqlClientInvariantName)); resolver.Unregister(SqlClientInvariantName); Assert.IsType <LegacyDbProviderServicesWrapper>( resolver.GetService(typeof(DbProviderServices), SqlClientInvariantName)); }
public static void UnregisterProvider(string invariantName) { Debug.Assert(!string.IsNullOrWhiteSpace(invariantName), "invariantName cannot be null or empty string"); ProviderServicesResolver.Unregister(invariantName); }