private string RenderGrid(IEnumerable <Person> dataSource) { var renderer = new HtmlTableGridRenderer <Person>(_engines); var viewContext = MockRepository.GenerateStub <ViewContext>(); viewContext.Writer = _writer; viewContext.View = MockRepository.GenerateStub <IView>(); viewContext.TempData = new TempDataDictionary(); var response = MockRepository.GenerateStub <HttpResponseBase>(); var context = MockRepository.GenerateStub <HttpContextBase>(); var request = MockRepository.GenerateStub <HttpRequestBase>(); viewContext.HttpContext = context; context.Stub(x => x.Response).Return(response); context.Stub(x => x.Request).Return(request); response.Output = _writer; request.Stub(x => x.ApplicationPath).Return("/"); request.Stub(x => x.QueryString).Return(_querystring); response.Expect(x => x.ApplyAppPathModifier(Arg <string> .Is.Anything)) .Do(new Func <string, string>(x => x)) .Repeat.Any(); renderer.Render(_model, dataSource, _writer, viewContext); return(_writer.ToString()); }
private string RenderGrid(IEnumerable <Person> dataSource) { var renderer = new HtmlTableGridRenderer <Person>(_engines); var viewContext = MockRepository.GenerateStub <ViewContext>(); viewContext.Writer = _writer; viewContext.View = MockRepository.GenerateStub <IView>(); viewContext.TempData = new TempDataDictionary(); var response = MockRepository.GenerateStub <HttpResponseBase>(); var context = MockRepository.GenerateStub <HttpContextBase>(); viewContext.HttpContext = context; context.Stub(p => p.Response).Return(response); response.Stub(p => p.Output).Return(_writer); renderer.Render(_model, dataSource, _writer, viewContext); return(_writer.ToString()); }
private string RenderGrid(IEnumerable<Person> dataSource) { var renderer = new HtmlTableGridRenderer<Person>(_engines); var viewContext = MockRepository.GenerateStub<ViewContext>(); viewContext.Writer = _writer; viewContext.View = MockRepository.GenerateStub<IView>(); viewContext.TempData = new TempDataDictionary(); var response = MockRepository.GenerateStub<HttpResponseBase>(); var context = MockRepository.GenerateStub<HttpContextBase>(); viewContext.HttpContext = context; context.Stub(p =>p.Response).Return(response); response.Stub(p => p.Output).Return(_writer); renderer.Render(_model, dataSource, _writer, viewContext); return _writer.ToString(); }
private string RenderGrid(IEnumerable<Person> dataSource) { var renderer = new HtmlTableGridRenderer<Person>(_engines); var viewContext = MockRepository.GenerateStub<ViewContext>(); viewContext.Writer = _writer; viewContext.View = MockRepository.GenerateStub<IView>(); viewContext.TempData = new TempDataDictionary(); var response = MockRepository.GenerateStub<HttpResponseBase>(); var context = MockRepository.GenerateStub<HttpContextBase>(); var request = MockRepository.GenerateStub<HttpRequestBase>(); viewContext.HttpContext = context; context.Stub(x =>x.Response).Return(response); context.Stub(x => x.Request).Return(request); response.Output = _writer; request.Stub(x => x.ApplicationPath).Return("/"); request.Stub(x => x.QueryString).Return(_querystring); response.Expect(x => x.ApplyAppPathModifier(Arg<string>.Is.Anything)) .Do(new Func<string,string>(x => x)) .Repeat.Any(); renderer.Render(_model, dataSource, _writer, viewContext); return _writer.ToString(); }