public void GetControllerSessionBehaviorGuardClauses() { // Arrange RequestContext requestContext = new RequestContext(new Mock <HttpContextBase>().Object, new RouteData()); IControllerFactory factory = new DefaultControllerFactory(); // Act & Assert Assert.ThrowsArgumentNull( () => factory.GetControllerSessionBehavior(null, "controllerName"), "requestContext" ); Assert.ThrowsArgumentNullOrEmpty( () => factory.GetControllerSessionBehavior(requestContext, null), "controllerName" ); Assert.ThrowsArgumentNullOrEmpty( () => factory.GetControllerSessionBehavior(requestContext, ""), "controllerName" ); }
public void GetControllerSessionBehaviorReturnsAttributeValueFromController() { // Arrange var factory = new DefaultControllerFactory(); // Act SessionStateBehavior result = factory.GetControllerSessionBehavior(null, typeof(MyReadOnlyController)); // Assert Assert.Equal(SessionStateBehavior.ReadOnly, result); }
public void GetControllerSessionBehaviorReturnsDefaultForControllerWithoutAttribute() { // Arrange var factory = new DefaultControllerFactory(); // Act SessionStateBehavior result = factory.GetControllerSessionBehavior(null, typeof(object)); // Assert Assert.Equal(SessionStateBehavior.Default, result); }
public void GetControllerSessionBehaviorReturnsDefaultForNullControllerType() { // Arrange var factory = new DefaultControllerFactory(); // Act SessionStateBehavior result = factory.GetControllerSessionBehavior(null, null); // Assert Assert.Equal(SessionStateBehavior.Default, result); }
public void GetControllerSessionBehaviorGuardClauses() { // Arrange RequestContext requestContext = new RequestContext(new Mock<HttpContextBase>().Object, new RouteData()); IControllerFactory factory = new DefaultControllerFactory(); // Act & Assert Assert.ThrowsArgumentNull( () => factory.GetControllerSessionBehavior(null, "controllerName"), "requestContext" ); Assert.ThrowsArgumentNullOrEmpty( () => factory.GetControllerSessionBehavior(requestContext, null), "controllerName" ); Assert.ThrowsArgumentNullOrEmpty( () => factory.GetControllerSessionBehavior(requestContext, ""), "controllerName" ); }