public void Should_throw_ConfigurationErrorsException() { // Arrange var configurationExpression = new RootConfiguration(); configurationExpression.GetAuthenticationStatusFrom(StaticHelper.IsAuthenticatedReturnsFalse); configurationExpression.For<BlogController>(x => x.Index()); // Assert Assert.Throws<ConfigurationErrorsException>(() => configurationExpression.GetRolesFrom(StaticHelper.GetRolesExcludingOwner)); }
public void Should_have_policycontainer_for_TaskController_LongRunningJsonAction() { // Arrange var configurationExpression = new RootConfiguration(); configurationExpression.GetAuthenticationStatusFrom(StaticHelper.IsAuthenticatedReturnsFalse); // Act configurationExpression.For<TaskController>(x => x.LongRunningJsonAction()); // Assert var policyContainer = configurationExpression.Runtime.PolicyContainers.First(); Assert.That(policyContainer.ControllerName, Is.EqualTo(NameHelper.Controller<TaskController>())); Assert.That(policyContainer.ActionName, Is.EqualTo("LongRunningJsonAction")); Assert.That(configurationExpression.Runtime.PolicyContainers.Count(), Is.EqualTo(1)); }
public void Should_have_policycontainer_for_all_actions_including_void_actions() { // Arrange var configurationExpression = new RootConfiguration(); configurationExpression.GetAuthenticationStatusFrom(StaticHelper.IsAuthenticatedReturnsFalse); // Act configurationExpression.For<ParentVoidActionController>(); // Assert Assert.That(configurationExpression.Runtime.PolicyContainers.Count(), Is.EqualTo(2)); }
public void Should_have_policycontainer_for_AliasedController_ActualAction() { // Arrange var configurationExpression = new RootConfiguration(); configurationExpression.GetAuthenticationStatusFrom(StaticHelper.IsAuthenticatedReturnsFalse); // Act configurationExpression.For<AliasedController>(); // Assert var policyContainer = configurationExpression.Runtime.PolicyContainers.First(); Assert.That(policyContainer.ActionName, Is.EqualTo("AliasedAction")); Assert.That(configurationExpression.Runtime.PolicyContainers.Count(), Is.EqualTo(1)); }
public void Should_have_policycontainer_for_void_action_from_parent_controller() { // Arrange var configurationExpression = new RootConfiguration(); configurationExpression.GetAuthenticationStatusFrom(StaticHelper.IsAuthenticatedReturnsFalse); // Act configurationExpression.For<ChildVoidActionController>(x => x.VoidAction()); // Assert Assert.That(configurationExpression.Runtime.PolicyContainers.Count(), Is.EqualTo(1)); }