Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Feature: Add a setter for the Request property of the HttpActionExecutedContext to improve testability [973]

$
0
0
I was testing a filter that accessed the request and the response on the OnActionExecuted method. In order to setup the request on the HttpActionExecutedContext for my test I had to write all this code:

```
HttpControllerContext controllerContext = new HttpControllerContext();
controllerContext.Request = request;
HttpActionDescriptor descriptor = new ReflectedHttpActionDescriptor();
HttpActionContext actionContext = new HttpActionContext(controllerContext, descriptor);
HttpActionExecutedContext context = new HttpActionExecutedContext(actionContext, null);
```

As a customer I would prefer to have mocked the HttpActionExecutedContext to provide my test request. We should consider adding a setter on the Request property or making it virtual in order to let the user avoid writing the above code.

Comments: Make sure the ActionContext and HttpActionExecuted mockable for filter unit testing

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>