https://stackoverflow.com/questions/758066/how-to-mock-controller-user-using-moq
Simply mock the ControllerContext and assign it to the controller before running the method that needs testing.
Bruce Ng's software development blog
An archive of solutions of programming problems I have faced in my career
https://stackoverflow.com/questions/758066/how-to-mock-controller-user-using-moq
Simply mock the ControllerContext and assign it to the controller before running the method that needs testing.