Unit Testing using Fakes for HttpActionContext objects

Posted by Mahendrabasutkar under ASP.NET Web API on 4/30/2018 | Points: 10 | Views : 173 | Status : [Member] | Replies : 1
I have a Attribute which has the below property set.

actionContext.Request.Properties["isActiveUser"] = true
where actionContext is HttpActionContext actionContext

How do i carry out unit testing using fakes for the same
as using below code HttpRequestMessage() thows error
the type or namespace name 'httprequestmessage' could not be found.

HttpActionContext context = new HttpActionContext();
var headerValue = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", "bzUwkDal=");
var request = new System.Net.Http.HttpRequestMessage();
request.Headers.Authorization = headerValue;
var controllerContext = new HttpControllerContext();
controllerContext.Request = request;
context.ControllerContext = controllerContext;
context.Request.Properties["isActiveUser"] = false;


Posted by: Nathanwilliam on: 5/21/2018 [Member] Starter | Points: 25

The clinical reasoning cycle is one of the most vital aspects of nursing and perhaps one of the most vital topics for case studies and nursing essays. Since the branch of academics related to nursing and medicine is an extended one with lots of sub-disciplinary areas to cover, one cannot afford to miss out on this crucial subject matter. This calls for online academic assistance services that are available these days. In case it is for the first time that you are planning to seek online help from professional academicians, then read through the following suggestions for the best result in the long run.


Contact us for any kind of Australian Assignment Help, homework help, coursework help.

Mahendrabasutkar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response