I am writing test cases using the Unit Test for ASP.NET Web API.
Now I have an action which makes a call to some method I have defined in the service layer, where I have used the following line of code.
string username = User.Identity.Name;
// do something with username
// return something
Now how to I create unit test method for this, I am getting null reference exceptions. I am kinda new to writing unit test and stuff.
I want to use Unit Test only for this. Please help me out on this.