public void Render(string errorMessage) { string bodyHtml = _bodyView.BuildHtml(errorMessage); string html = _pageView.BuildHtml(bodyHtml); _context.WriteToResponse(html); }
public void Correctly_builds_error_page_html() { MockRepository mocks = new MockRepository(); ILoadBalancerBodyView bodyView = mocks.CreateMock <ILoadBalancerBodyView>(); IPageView pageView = mocks.CreateMock <IPageView>(); IWebContext webContext = mocks.CreateMock <IWebContext>(); using (mocks.Record()) { Expect.Call(bodyView.BuildHtml("error message")).Return("some body html"); Expect.Call(pageView.BuildHtml("some body html")).Return("the page html"); webContext.WriteToResponse("the page html"); } using (mocks.Playback()) { ILoadBalancerView view = new LoadBalancerView(bodyView, pageView, webContext); view.Render("error message"); } }