Author: Tales from the Evil Empire : ASP.NET | Posted on: 6/15/2009 3:27:52 PM | Views : 989

I quite like MoQ because it makes sense for me. Shamefully, I?ve always had some trouble understanding test code that was using mocks built with other frameworks. With MoQ , I can just grok it for some reason. It?s just super-clear to me. It doesn?t mean I have any idea how it really works but for now I?m just happy with the magic. Anyway, yesterday I wanted to check that a controller action was setting some Application variable (let?s not get into the debate on whether or not it should do that at all). Something like this: application[ "foo" ] = new Foo (); Now how do I enable the object to be set by the tested code? Well, that one is easy, I can use SetupSet on indexers just fine: var mockHttpContext = new Mock < HttpContextBase...(read more) ...

Go to the complete details ...