public void EnsureProvider_registers_provider() { DependencyResolver.EnsureProvider("System.Data.SqlClient", typeof(SqlProviderServices)); try { Assert.Same( SqlProviderServices.Instance, DependencyResolver.GetService <DbProviderServices>("System.Data.SqlClient")); } finally { DependencyResolver.UnregisterProvider("System.Data.SqlClient"); } }
public void DependencyResolver_can_register_unregister_provider() { DependencyResolver.RegisterProvider(typeof(SqlProviderServices), "System.Data.SqlClient"); try { Assert.Same( SqlProviderServices.Instance, DependencyResolver.GetService <DbProviderServices>("System.Data.SqlClient")); } finally { DependencyResolver.UnregisterProvider("System.Data.SqlClient"); } Assert.IsType <LegacyDbProviderServicesWrapper>( DependencyResolver.GetService <DbProviderServices>("System.Data.SqlClient")); }