예제 #1
0
        public void RenderFirstPage()
        {
            var currentPageIndex = 0;
            var totalPageCount   = 2;

            List.Stub(mock => mock.CurrentPageIndex).Return(currentPageIndex);
            List.Stub(mock => mock.PageCount).Return(totalPageCount);

            var renderer = new BocListNavigationBlockRenderer(
                new FakeResourceUrlFactory(),
                GlobalizationService,
                RenderingFeatures.Default,
                _bocListCssClassDefinition);

            renderer.Render(new BocListRenderingContext(HttpContext, Html.Writer, List, new BocColumnRenderer[0]));

            var document = Html.GetResultDocument();

            var div = Html.GetAssertedChildElement(document, "div", 0);

            Html.AssertAttribute(div, "class", _bocListCssClassDefinition.Navigator);

            var manualInput = Html.GetAssertedChildElement(div, "span", 0);

            AssertManualInputArea(manualInput, currentPageIndex, totalPageCount);

            var firstIcon = Html.GetAssertedChildElement(div, "a", 1);

            AssertInactiveIcon(firstIcon, "First");

            var previousIcon = Html.GetAssertedChildElement(div, "a", 2);

            AssertInactiveIcon(previousIcon, "Previous");

            var nextIcon = Html.GetAssertedChildElement(div, "a", 3);

            AssertActiveIcon(nextIcon, "Next", 1);

            var lastIcon = Html.GetAssertedChildElement(div, "a", 4);

            AssertActiveIcon(lastIcon, "Last", 1);

            var pageIndexField = Html.GetAssertedChildElement(div, "input", 5);

            AssertPageIndexHiddenField(pageIndexField, currentPageIndex);
        }
예제 #2
0
        public void TestDiagnosticMetadataRendering()
        {
            var currentPageIndex = 3;
            var totalPageCount   = 7;

            List.Stub(mock => mock.CurrentPageIndex).Return(currentPageIndex);
            List.Stub(mock => mock.PageCount).Return(totalPageCount);

            var renderer = new BocListNavigationBlockRenderer(
                new FakeResourceUrlFactory(),
                GlobalizationService,
                RenderingFeatures.WithDiagnosticMetadata,
                _bocListCssClassDefinition);

            renderer.Render(new BocListRenderingContext(HttpContext, Html.Writer, List, new BocColumnRenderer[0]));

            var document = Html.GetResultDocument();

            var div = Html.GetAssertedChildElement(document, "div", 0);

            Html.AssertAttribute(div, DiagnosticMetadataAttributesForObjectBinding.BocListNumberOfPages, totalPageCount.ToString());
        }