public void Setup()
 {
     _writer = new StringWriter();
     _context = new ViewContext();
     _viewEngine = MockRepository.GenerateMock<IViewEngine>();
     _engines = new ViewEngineCollection(new List<IViewEngine> { _viewEngine });
     _context.HttpContext = MvcMockHelpers.DynamicHttpContextBase();
     _renderContext = new RenderingContext(_writer, _context, _engines);
 }
        public static RenderingContext FakeRenderingContext()
        {
            var engine = MockRepository.GenerateStub<IViewEngine>();
            engine.Stub(x => x.FindPartialView(null, null, true)).IgnoreArguments().Return(new ViewEngineResult(MockRepository.GenerateStub<IView>(), engine)).Repeat.Any();

            var context = new RenderingContext(
                new StringWriter(),
                new ViewContext() { View = MockRepository.GenerateStub<IView>(), TempData = new TempDataDictionary() },
                new ViewEngineCollection(new List<IViewEngine>() { engine }));

            return context;
        }