//[Ignore("Release script thinks this test fails, but it works run in Visual Studio / Resharper")] public void TestCodeConfig() { ProviderResolver <SecurityContextProvider> .Configure() .AppendActive(new WebSecurityContextProvider("web")); Assert.IsNotNull(ProviderResolver <SecurityContextProvider> .Get.Provider); }
/// <summary> /// Sets the <see cref="Providers"/> collection to a new list and returns the resolver for further configuration. /// </summary> /// <returns></returns> public static ProviderResolver <T> Configure() { var resolver = new ProviderResolver <T> { Providers = new ProviderCollection <T>() }; ProviderResolverDictionary.Resolvers[typeof(T)] = resolver; return(resolver); }
//[Ignore("Release script thinks this test fails, but it works run in Visual Studio / Resharper")] public void TestCodeConfig2() { ProviderResolver <UserProvider> .Configure() .Append(new sql.UserProvider("sql") { PasswordRegexExpression = ".*" }) .AppendActive(new MockUserProvider()); //assert that a provider is configured with the option specified (although not the best expression for passwords :) Assert.AreEqual(".*", ProviderResolver <UserProvider> .Get.Providers["sql"].PasswordRegexExpression); //assert that the main provider is the mock one set as 'active' during configure Assert.AreEqual(typeof(MockUserProvider), ProviderResolver <UserProvider> .Get.Provider.GetType()); }