public void RenderTitlesRow()
        {
            IBocRowRenderer renderer = new BocRowRenderer(
                _bocListCssClassDefinition,
                new BocIndexColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition),
                new BocSelectorColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition),
                RenderingFeatures.Default);

            renderer.RenderTitlesRow(new BocListRenderingContext(HttpContext, Html.Writer, List, _columnRenderers));

            var document = Html.GetResultDocument();

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

            Html.GetAssertedChildElement(tr, "th", 0);
        }
        public void RenderEmptyDataRow()
        {
            List.Stub(mock => mock.IsIndexEnabled).Return(true);
            List.Stub(mock => mock.IsSelectionEnabled).Return(true);

            IBocRowRenderer renderer = new BocRowRenderer(
                _bocListCssClassDefinition,
                new BocIndexColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition),
                new BocSelectorColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition),
                RenderingFeatures.Default);

            renderer.RenderEmptyListDataRow(new BocListRenderingContext(HttpContext, Html.Writer, List, _columnRenderers));

            var document = Html.GetResultDocument();

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

            Html.GetAssertedChildElement(tr, "td", 0);
        }
        public void TestDiagnosticMetadataRendering()
        {
            IBocRowRenderer renderer = new BocRowRenderer(
                _bocListCssClassDefinition,
                new BocIndexColumnRenderer(RenderingFeatures.WithDiagnosticMetadata, _bocListCssClassDefinition),
                new BocSelectorColumnRenderer(RenderingFeatures.WithDiagnosticMetadata, _bocListCssClassDefinition),
                RenderingFeatures.WithDiagnosticMetadata);

            renderer.RenderDataRow(
                new BocListRenderingContext(HttpContext, Html.Writer, List, _columnRenderers),
                new BocListRowRenderingContext(new BocListRow(0, BusinessObject), 1, false),
                0);

            var document = Html.GetResultDocument();

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

            Html.AssertAttribute(tr, DiagnosticMetadataAttributes.ItemID, ((IBusinessObjectWithIdentity)BusinessObject).UniqueIdentifier);
            Html.AssertAttribute(tr, DiagnosticMetadataAttributesForObjectBinding.BocListRowIndex, 1.ToString());
        }
        public void RenderDataRow()
        {
            IBocRowRenderer renderer = new BocRowRenderer(
                _bocListCssClassDefinition,
                new BocIndexColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition),
                new BocSelectorColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition),
                RenderingFeatures.Default);

            renderer.RenderDataRow(
                new BocListRenderingContext(HttpContext, Html.Writer, List, _columnRenderers),
                new BocListRowRenderingContext(new BocListRow(0, BusinessObject), 1, false),
                0);

            var document = Html.GetResultDocument();

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

            Html.AssertAttribute(tr, "class", _bocListCssClassDefinition.DataRow + " " + _bocListCssClassDefinition.DataRowOdd);

            Html.GetAssertedChildElement(tr, "td", 0);
        }
        public void RenderTitlesRowWithIndex()
        {
            List.Stub(mock => mock.IsIndexEnabled).Return(true);
            List.Stub(mock => mock.Index).Return(RowIndex.InitialOrder);

            IBocRowRenderer renderer = new BocRowRenderer(
                _bocListCssClassDefinition,
                new BocIndexColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition),
                new BocSelectorColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition),
                RenderingFeatures.Default);

            renderer.RenderTitlesRow(new BocListRenderingContext(HttpContext, Html.Writer, List, _columnRenderers));

            var document = Html.GetResultDocument();

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

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

            Html.AssertAttribute(thIndex, "class", _bocListCssClassDefinition.TitleCell, HtmlHelperBase.AttributeValueCompareMode.Contains);
            Html.AssertAttribute(thIndex, "class", _bocListCssClassDefinition.TitleCellIndex, HtmlHelperBase.AttributeValueCompareMode.Contains);

            Html.GetAssertedChildElement(tr, "th", 1);
        }