ASP/NET MVC: Test Controllers w/Sessions? Mocking?

Posted by Codewerks on Stack Overflow See other posts from Stack Overflow or by Codewerks
Published on 2008-10-06T21:49:05Z Indexed on 2010/03/25 19:03 UTC
Read the original article Hit count: 370

I read some of the answers on here re: testing views and controllers, and mocking, but I still can't figure out how to test an ASP.NET MVC controller that reads and sets Session values (or any other context based variables.) How do I provide a (Session) context for my test methods? Is mocking the answer? Anybody have examples? Basically, I'd like to fake a session before I call the controller method and have the controller use that session. Any ideas?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about mocking