private void InitializeProvider() { const string name = "ProviderName"; var factory = A.Fake <IProviderConfigFactory>(); var config = new NameValueCollection(); A.CallTo(() => providerConfig.Name).Returns(name); A.CallTo(() => factory.Create <LdapMembershipProvider>(name, config)).Returns(providerConfig); provider = new LdapMembershipProvider(factory); provider.Initialize(name, config); }
public void SetUp() { var config = new NameValueCollection(); config.Add("applicationName", "IntegrationTests"); config.Add("ldapServer", LdapServerInConfig); var ldapProvider = new LdapMembershipProvider(); ldapProvider.Initialize("IntegrationTests", config); var providers = Membership.Providers; var readOnlyField = typeof(System.Configuration.Provider.ProviderCollection).GetField("_ReadOnly", BindingFlags.NonPublic | BindingFlags.Instance); readOnlyField.SetValue(providers, false); providers.Add(ldapProvider); var registeredProvider = Membership.Providers["IntegrationTests"]; Assert.IsNotNull(registeredProvider); provider = registeredProvider; }
public void SetUp() { var config = new NameValueCollection(); config.Add("applicationName", "IntegrationTests"); config.Add("ldapServer", LdapServerInConfig); var ldapProvider = new LdapMembershipProvider(); ldapProvider.Initialize("IntegrationTests", config); var providers = Membership.Providers; var readOnlyField = typeof(System.Configuration.Provider.ProviderCollection).GetField("_ReadOnly", BindingFlags.NonPublic | BindingFlags.Instance); readOnlyField.SetValue(providers, false); providers.Add(ldapProvider); var registeredProvider = Membership.Providers["IntegrationTests"]; Assert.IsNotNull(registeredProvider); provider = registeredProvider; }
private void InitializeProvider() { const string name = "ProviderName"; var factory = A.Fake<IProviderConfigFactory>(); var config = new NameValueCollection(); A.CallTo(() => providerConfig.Name).Returns(name); A.CallTo(() => factory.Create<LdapMembershipProvider>(name, config)).Returns(providerConfig); provider = new LdapMembershipProvider(factory); provider.Initialize(name, config); }