How do you mock the session object collection using Moq

Posted by rayray2030 on Stack Overflow See other posts from Stack Overflow or by rayray2030
Published on 2009-02-07T19:54:45Z Indexed on 2010/03/26 9:43 UTC
Read the original article Hit count: 443

Filed under:
|
|
|

I am using shanselmann's MvcMockHelper class to mock up some HttpContext stuff using Moq but the issue I am having is being able to assign something to my mocked session object in my MVC controller and then being able to read that same value in my unit test for verification purposes.

My question is how do you assign a storage collection to the mocked session object to allow code such as session["UserName"] = "foo" to retain the "foo" value and have it be available in the unit test.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about moq