public void ConfigureShouldNotThrowExceptionIfAuthorizationServicesIsNotLoaded() { MockServiceCollection collection = new MockServiceCollection(); TestableModuleInitializer module = new TestableModuleInitializer(); module.Configure(collection, ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)); MockAuthorizationRulesService authRulesServices = (MockAuthorizationRulesService)collection.Get <IAuthorizationRulesService>(); Assert.IsNull(authRulesServices); }
public void ConfigureShouldRegisterAuthorizationRules() { MockServiceCollection collection = new MockServiceCollection(); collection.Add(typeof(IAuthorizationRulesService), new MockAuthorizationRulesService()); TestableModuleInitializer module = new TestableModuleInitializer(); module.Configure(collection, ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)); MockAuthorizationRulesService authRulesServices = (MockAuthorizationRulesService)collection.Get <IAuthorizationRulesService>(); Assert.AreEqual(1, authRulesServices.RegisteredAuthorizationRules.Count); Assert.IsTrue(authRulesServices.RegisteredAuthorizationRules.ContainsKey("Default.aspx")); Assert.AreEqual("MockRule01", authRulesServices.RegisteredAuthorizationRules["Default.aspx"]); }