public void Should_throw_exception_when_all_actions_are_not_configured() { //Arrange & Act var securityConfiguration = new SecurityConfiguration(policy => {}); //Assert Assert.Throws<ConfigurationErrorsException>(() => securityConfiguration.AssertAllActionsAreConfigured(new [] { GetType().Assembly })); }
public void Should_throw_exception_when_all_actions_are_not_configured() { //Arrange & Act var securityConfiguration = new SecurityConfiguration(policy => {}); //Assert Assert.Throws <ConfigurationErrorsException>(() => securityConfiguration.AssertAllActionsAreConfigured(new [] { GetType().Assembly })); }
public void Should_not_throw_exception_when_all_actions_are_configured() { //Arrange & Act var securityConfiguration = new SecurityConfiguration(policy => policy .ForAllControllers() .DenyAuthenticatedAccess() ); //Assert Assert.DoesNotThrow(() => securityConfiguration.AssertAllActionsAreConfigured(new [] { GetType().Assembly })); }
public void Should_not_throw_exception_when_all_actions_are_configured() { //Arrange & Act var assemblies = ( from Assembly assembly in AppDomain.CurrentDomain.GetAssemblies() where !(assembly is System.Reflection.Emit.AssemblyBuilder) && assembly.GetType().FullName != "System.Reflection.Emit.InternalAssemblyBuilder" && !assembly.GlobalAssemblyCache select assembly ).ToArray(); var securityConfiguration = new SecurityConfiguration(policy => policy .ForAllControllersInAssembly(assemblies) .DenyAuthenticatedAccess() ); //Assert Assert.DoesNotThrow(() => securityConfiguration.AssertAllActionsAreConfigured()); }