private void RenderTitleCell(
            SortingDirection sortDirection,
            int sortIndex,
            string iconFilename,
            string iconAltText)
        {
            IBocColumnRenderer renderer = new BocSimpleColumnRenderer(new FakeResourceUrlFactory(), RenderingFeatures.Default, _bocListCssClassDefinition);

            renderer.RenderTitleCell(_renderingContext, sortDirection, sortIndex);

            var document = Html.GetResultDocument();

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

            Html.AssertAttribute(th, "class", _bocListCssClassDefinition.TitleCell, HtmlHelperBase.AttributeValueCompareMode.Contains);
            Html.AssertAttribute(th, "class", c_columnCssClass, HtmlHelperBase.AttributeValueCompareMode.Contains);

            Assert.Less(0, th.ChildNodes.Count);
            var sortCommandLink = Html.GetAssertedChildElement(th, "a", 0);

            Html.AssertAttribute(sortCommandLink, "id", List.ClientID + "_0_SortCommand");
            Html.AssertTextNode(sortCommandLink, Column.ColumnTitleDisplayValue + HtmlHelper.WhiteSpace, 0);

            var sortOrderSpan = Html.GetAssertedChildElement(sortCommandLink, "span", 1);

            Html.AssertAttribute(sortOrderSpan, "class", _bocListCssClassDefinition.SortingOrder, HtmlHelperBase.AttributeValueCompareMode.Contains);

            var sortIcon = Html.GetAssertedChildElement(sortOrderSpan, "img", 0);

            Html.AssertAttribute(sortIcon, "src", iconFilename, HtmlHelperBase.AttributeValueCompareMode.Contains);
            Html.AssertAttribute(sortIcon, "alt", iconAltText);

            Html.AssertTextNode(sortOrderSpan, HtmlHelper.WhiteSpace + (sortIndex + 1), 1);
        }
        public void RenderTitleCellNoSorting()
        {
            IBocColumnRenderer renderer = new BocSimpleColumnRenderer(new FakeResourceUrlFactory(), RenderingFeatures.Default, _bocListCssClassDefinition);

            renderer.RenderTitleCell(_renderingContext, SortingDirection.None, -1);

            var document = Html.GetResultDocument();

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

            Html.AssertAttribute(th, "class", _bocListCssClassDefinition.TitleCell, HtmlHelperBase.AttributeValueCompareMode.Contains);
            Html.AssertAttribute(th, "class", c_columnCssClass, HtmlHelperBase.AttributeValueCompareMode.Contains);

            Assert.Less(0, th.ChildNodes.Count);
            var sortCommandLink = Html.GetAssertedChildElement(th, "a", 0);

            Html.AssertAttribute(sortCommandLink, "id", List.ClientID + "_0_SortCommand");
            Html.AssertTextNode(sortCommandLink, Column.ColumnTitleDisplayValue, 0);

            Html.AssertChildElementCount(sortCommandLink, 0);
        }
        public void TestDiagnosticMetadataRenderingInTitle()
        {
            IBocColumnRenderer renderer = new BocSimpleColumnRenderer(
                new FakeResourceUrlFactory(),
                RenderingFeatures.WithDiagnosticMetadata,
                _bocListCssClassDefinition);

            Column.ItemID = "TestItemID";

            _renderingContext =
                new BocColumnRenderingContext <BocSimpleColumnDefinition> (new BocColumnRenderingContext(HttpContext, Html.Writer, List, Column, 0, 6));

            renderer.RenderTitleCell(_renderingContext, SortingDirection.None, 0);

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

            Html.AssertAttribute(th, DiagnosticMetadataAttributes.ItemID, Column.ItemID);
            Html.AssertAttribute(th, DiagnosticMetadataAttributes.Content, Column.ColumnTitleDisplayValue);
            Html.AssertAttribute(th, DiagnosticMetadataAttributesForObjectBinding.BocListCellIndex, 7.ToString());
            Html.AssertAttribute(th, DiagnosticMetadataAttributesForObjectBinding.BocListColumnHasDiagnosticMetadata, "true");
        }