public void OnActionExecutedOnNullResponse() { // Arrange HttpRequestMessage request = new HttpRequestMessage(); var actionContext = ContextUtil.GetActionExecutedContext(request, response: null); // Act & Assert Assert.DoesNotThrow(() => _filter.OnActionExecuted(actionContext)); Assert.Null(actionContext.Response); }
public QueryableAttributeTest() { _response.RequestMessage = _request; _actionContext = ContextUtil.CreateActionContext(ContextUtil.CreateControllerContext(request: _request)); _actionContext.ControllerContext.ControllerDescriptor = new HttpControllerDescriptor { ControllerName = "TestControllerName" }; Mock.Get(_actionContext.ActionDescriptor).Setup(ad => ad.ActionName).Returns("testActionName"); _actionContext.Response = _response; _actionExecutedContext = ContextUtil.GetActionExecutedContext(_request, _response); _actionExecutedContext.ActionContext = _actionContext; }