Example #1
0
        public void Render(string errorMessage)
        {
            string bodyHtml = _bodyView.BuildHtml(errorMessage);
            string html     = _pageView.BuildHtml(bodyHtml);

            _context.WriteToResponse(html);
        }
Example #2
0
        public void Render()
        {
            string bodyHtml = bodyView.BuildHtml();
            string html     = pageView.BuildHtml(bodyHtml);

            webContext.WriteToResponse(html);
        }
        public void Correctly_builds_page_html()
        {
            MockRepository mocks = new MockRepository();
            IApplicationListingBodyView bodyView = mocks.CreateMock <IApplicationListingBodyView>();
            IPageView   pageView   = mocks.CreateMock <IPageView>();
            IWebContext webContext = mocks.CreateMock <IWebContext>();

            using (mocks.Record())
            {
                Expect.Call(bodyView.BuildHtml()).Return("some body html");
                Expect.Call(pageView.BuildHtml("some body html")).Return("the page html");
                webContext.WriteToResponse("the page html");
            }

            using (mocks.Playback())
            {
                IApplicationListingView view = new ApplicationListingView(bodyView, pageView, webContext);
                view.Render();
            }
        }
Example #4
0
        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");
            }
        }