public void OnActionExecutingThrowsIfFilterContextIsNull() { // Arrange AsyncTimeoutAttribute attr = new AsyncTimeoutAttribute(45); // Act & assert ExceptionHelper.ExpectArgumentNullException( delegate { attr.OnActionExecuting(null); }, "filterContext"); }
public void OnActionExecutingThrowsIfFilterContextIsNull() { // Arrange AsyncTimeoutAttribute attr = new AsyncTimeoutAttribute(45); // Act & assert ExceptionHelper.ExpectArgumentNullException( delegate { attr.OnActionExecuting(null); }, "filterContext"); }
public void OnActionExecutingThrowsIfControllerIsNotAsyncManagerContainer() { // Arrange AsyncTimeoutAttribute attr = new AsyncTimeoutAttribute(45); ActionExecutingContext filterContext = new ActionExecutingContext() { Controller = new MyController() }; // Act & assert ExceptionHelper.ExpectInvalidOperationException( delegate { attr.OnActionExecuting(filterContext); }, @"The controller of type 'Microsoft.Web.Mvc.Test.AsyncTimeoutAttributeTest+MyController' must subclass AsyncController or implement the IAsyncManagerContainer interface."); }
public void OnActionExecutingThrowsIfControllerIsNotAsyncManagerContainer() { // Arrange AsyncTimeoutAttribute attr = new AsyncTimeoutAttribute(45); ActionExecutingContext filterContext = new ActionExecutingContext() { Controller = new MyController() }; // Act & assert ExceptionHelper.ExpectInvalidOperationException( delegate { attr.OnActionExecuting(filterContext); }, @"The controller of type 'Microsoft.Web.Mvc.Test.AsyncTimeoutAttributeTest+MyController' must subclass AsyncController or implement the IAsyncManagerContainer interface."); }
public void OnActionExecutingSetsTimeoutPropertyOnController() { // Arrange AsyncTimeoutAttribute attr = new AsyncTimeoutAttribute(45); MyAsyncController controller = new MyAsyncController(); controller.AsyncManager.Timeout = 0; ActionExecutingContext filterContext = new ActionExecutingContext() { Controller = controller }; // Act attr.OnActionExecuting(filterContext); // Assert Assert.AreEqual(45, controller.AsyncManager.Timeout); }
public void OnActionExecutingSetsTimeoutPropertyOnController() { // Arrange AsyncTimeoutAttribute attr = new AsyncTimeoutAttribute(45); MyAsyncController controller = new MyAsyncController(); controller.AsyncManager.Timeout = 0; ActionExecutingContext filterContext = new ActionExecutingContext() { Controller = controller }; // Act attr.OnActionExecuting(filterContext); // Assert Assert.AreEqual(45, controller.AsyncManager.Timeout); }