Reputation: 2209
Currently i am writing a unit tests for my handler methods using NUnit.I have used HttpContext.Current
in one of my Controller Methods which throws NULL reference exception at HttpContext.Current
when i execute test cases for my handler.
Is there any way i can mock HttpContext?or is there any other way to solve this issue.
Upvotes: 4
Views: 332
Reputation: 32698
You should not need to access HttpContext.Current
directly. You should be able to use one of the available dependencies which are easily mockable.
Upvotes: 4