As the title says, I\'m looking for direction on how to properly test a controller extension. The extension renders a partial view which in turn I\'m using within a JSONResu
You will have to add a mocked view engine to the ViewEngines.Engines
collection so that you can mock the FindPartialView call. Here's an example with Rhino Mocks:
var view = MockRepository.GenerateStub<IView>();
var engine = MockRepository.GenerateStub<IViewEngine>();
var viewEngineResult = new ViewEngineResult(view, engine);
engine
.Stub(x => x.FindPartialView(null, null, false))
.IgnoreArguments()
.Return(viewEngineResult);
ViewEngines.Engines.Add(engine);
Then you could assert that the view.Render method was called, intercept its arguments and write some mocked data to this writer and finally assert that your controller action returned this mocked string.