Mocking WebSecurity provider
问题 I'm trying to create some simple unit tests for my controllers and I've come across an issue. I'm using the new membership provider in MVC 4 and getting the WebSecurity.CurrentUserId and storing that value in the database. When I run my unit tests against this it's failing and I think I have track this back to the fact that the WebSecurity isn't being mocked at all. Here's my code if it helps at all, The Controller [HttpPost] public ActionResult Create(CreateOrganisationViewModel viewModel) {