dimanche 1 mai 2016

HttpContext.Current always null when sending request from unit test

I have Web Api controller Action method i am trying to unit test. I have one custom filter which runs befofore that action controller.

I have question regarding HttpContext.Current.User.Identity.Name that i am using inside my custom action filter.

It works nicely when i send my http post request from web client.

But, when i send http post request from my unit test than HttpContext.Current always complain for null

Don't understand where and what is wrong. Anybody can please explain it?

Aucun commentaire:

Enregistrer un commentaire