Exemple #1
0
 public void AddRow(BocListRow row)
 {
     if (NotifyAddRow != null)
     {
         NotifyAddRow(row);
     }
 }
Exemple #2
0
 public void RemoveRow(BocListRow row)
 {
     if (NotifyRemoveRow != null)
     {
         NotifyRemoveRow(row);
     }
 }
Exemple #3
0
        public void RenderDataCellForMultiSelect()
        {
            var row = new BocListRow(1, BusinessObject);

            List.Stub(mock => mock.Selection).Return(RowSelection.Multiple);
            List.Stub(mock => mock.GetSelectorControlValue(row)).Return("row1");
            IBocSelectorColumnRenderer renderer = new BocSelectorColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition);

            renderer.RenderDataCell(
                _bocListRenderingContext,
                new BocListRowRenderingContext(row, 0, false),
                "bocListTableCell");

            var document = Html.GetResultDocument();

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

            Html.AssertAttribute(td, "class", "bocListTableCell");

            var input = Html.GetAssertedChildElement(td, "input", 0);

            Html.AssertAttribute(input, "type", "checkbox");
            Html.AssertAttribute(input, "id", "SelectRowControl_UnqiueID_1");
            Html.AssertAttribute(input, "name", "SelectRowControl$UnqiueID");
            Html.AssertAttribute(input, "value", "row1");
            Html.AssertAttribute(input, "alt", "Select this row");
        }
Exemple #4
0
        public void RenderDataCellForSingleSelect()
        {
            var row = new BocListRow(1, BusinessObject);

            List.Stub(mock => mock.Selection).Return(RowSelection.SingleRadioButton);
            List.Stub(mock => mock.GetSelectorControlValue(row)).Return("row1");
            IBocSelectorColumnRenderer renderer = new BocSelectorColumnQuirksModeRenderer(_bocListQuirksModeCssClassDefinition);

            renderer.RenderDataCell(
                new BocListRenderingContext(HttpContext, Html.Writer, List, new BocColumnRenderer[0]),
                new BocListRowRenderingContext(row, 0, false),
                "bocListTableCell");
            var document = Html.GetResultDocument();

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

            Html.AssertAttribute(td, "class", "bocListTableCell");

            var input = Html.GetAssertedChildElement(td, "input", 0);

            Html.AssertAttribute(input, "type", "radio");
            Html.AssertAttribute(input, "id", "SelectRowControl_UnqiueID_0");
            Html.AssertAttribute(input, "name", "SelectRowControl$UnqiueID");
            Html.AssertAttribute(input, "value", "row1");
            Html.AssertAttribute(input, "alt", "Select this row");
        }
        public BocListRowRenderingContext(BocListRow row, int sortedIndex, bool isSelected)
        {
            ArgumentUtility.CheckNotNull("row", row);

            _row         = row;
            _sortedIndex = sortedIndex;
            _isSelected  = isSelected;
        }
Exemple #6
0
        private EditableRow AddRowToDataStructure(BocListRow bocListRow, BocColumnDefinition[] columns)
        {
            EditableRow row = CreateEditableRow(bocListRow, columns);

            Controls.Add(row);
            _rows.Add(row);

            return(row);
        }
        public void IEquatable_SameBusinessObject_OtherIndex_AreNotEqual()
        {
            var businessObject           = MockRepository.GenerateStub <IBusinessObject>();
            IEquatable <BocListRow> row1 = new BocListRow(4, businessObject);
            IEquatable <BocListRow> row2 = new BocListRow(6, businessObject);

            Assert.That(row1.Equals(row2), Is.False);
            Assert.That(row2.Equals(row1), Is.False);
        }
        public void IEquatable_OtherBusinessObject_SameIndex_AreNotEqual()
        {
            var index = 5;
            IEquatable <BocListRow> row1 = new BocListRow(index, MockRepository.GenerateStub <IBusinessObject>());
            IEquatable <BocListRow> row2 = new BocListRow(index, MockRepository.GenerateStub <IBusinessObject>());

            Assert.That(row1.Equals(row2), Is.False);
            Assert.That(row2.Equals(row1), Is.False);
        }
        public void GetHashcode_SameBusinessObject_SameIndex_SameHashcode()
        {
            var businessObject = MockRepository.GenerateStub <IBusinessObject>();
            var index          = 5;
            var row1           = new BocListRow(index, businessObject);
            var row2           = new BocListRow(index, businessObject);

            Assert.That(row1.GetHashCode(), Is.EqualTo(row2.GetHashCode()));
        }
        public void OperatorNotEqual_SameBusinessObject_OtherIndex_AreNotEqual()
        {
            var businessObject = MockRepository.GenerateStub <IBusinessObject>();
            var row1           = new BocListRow(4, businessObject);
            var row2           = new BocListRow(6, businessObject);

            Assert.That(row1 != row2, Is.True);
            Assert.That(row2 != row1, Is.True);
        }
        public void IEquatable_SameBusinessObject_SameIndex_AreEqual()
        {
            var businessObject           = MockRepository.GenerateStub <IBusinessObject>();
            var index                    = 5;
            IEquatable <BocListRow> row1 = new BocListRow(index, businessObject);
            IEquatable <BocListRow> row2 = new BocListRow(index, businessObject);

            Assert.That(row1.Equals(row2), Is.True);
            Assert.That(row2.Equals(row1), Is.True);
        }
        public void OperatorEqual_SameBusinessObject_SameIndex_AreEqual()
        {
            var businessObject = MockRepository.GenerateStub <IBusinessObject>();
            var index          = 5;
            var row1           = new BocListRow(index, businessObject);
            var row2           = new BocListRow(index, businessObject);

            Assert.That(row1 == row2, Is.True);
            Assert.That(row2 == row1, Is.True);
        }
        private void CompareDescendingValues(IComparer <BocListRow> comparer, IBusinessObject left, IBusinessObject right)
        {
            var rowLeft  = new BocListRow(0, left);
            var rowRight = new BocListRow(0, right);

            int compareResultLeftRight = comparer.Compare(rowLeft, rowRight);
            int compareResultRightLeft = comparer.Compare(rowRight, rowLeft);

            Assert.IsTrue(compareResultLeftRight > 0, "Right - Left >= zero.");
            Assert.IsTrue(compareResultRightLeft < 0, "Left - Right <= zero.");
        }
        public SortedRow(BocListRow valueRow, int sortedIndex)
        {
            ArgumentUtility.CheckNotNull("valueRow", valueRow);
            if (sortedIndex < 0)
            {
                throw new ArgumentOutOfRangeException("sortedIndex", sortedIndex, "Value cannot be negative");
            }

            _valueRow    = valueRow;
            _sortedIndex = sortedIndex;
        }
        private void CompareEqualValues(IComparer <BocListRow> comparer, IBusinessObject left, IBusinessObject right)
        {
            var rowLeft  = new BocListRow(0, left);
            var rowRight = new BocListRow(0, right);

            int compareResultLeftRight = comparer.Compare(rowLeft, rowRight);
            int compareResultRightLeft = comparer.Compare(rowRight, rowLeft);

            Assert.IsTrue(compareResultLeftRight == 0, "Left - Right != zero");
            Assert.IsTrue(compareResultRightLeft == 0, "Right - Left != zero");
        }
Exemple #16
0
        private EditableRow CreateEditableRow(BocListRow bocListRow, BocColumnDefinition[] columns)
        {
            EditableRow row = new EditableRow(_editModeHost);

            row.ID = ID + "_Row_" + _editModeHost.RowIDProvider.GetControlRowID(bocListRow);

            row.DataSourceFactory = _editModeHost.EditModeDataSourceFactory;
            row.ControlFactory    = _editModeHost.EditModeControlFactory;

            row.CreateControls(bocListRow.BusinessObject, columns);

            return(row);
        }
        private string GetRowID(BocListRow row)
        {
            if (row.Index >= _rowIDs.Count)
            {
                throw new InvalidOperationException(
                          string.Format(
                              "Tried to retrieve the ID for the row at index {0} but the current length of the row collection is {1}."
                              + "The index must not exceed the length of the row collection.",
                              row.Index,
                              _rowIDs.Count));
            }

            return(_rowIDs[row.Index]);
        }
        public void RemoveRow(BocListRow row)
        {
            ArgumentUtility.CheckNotNull("row", row);
            if (row.Index > _rowIDs.Count)
            {
                throw new InvalidOperationException(
                          string.Format(
                              "Tried to remove row at index {0} but the current length of the row collection is {1}."
                              + "The index must not exceed the length of the row collection.",
                              row.Index,
                              _rowIDs.Count));
            }

            _rowIDs.RemoveAt(row.Index);
        }
Exemple #19
0
        public void TestDiagnosticMetadataRenderingInDataCell()
        {
            var row = new BocListRow(1, BusinessObject);

            List.Stub(mock => mock.Selection).Return(RowSelection.SingleRadioButton);
            List.Stub(mock => mock.GetSelectorControlValue(row)).Return("row1");
            IBocSelectorColumnRenderer renderer = new BocSelectorColumnRenderer(RenderingFeatures.WithDiagnosticMetadata, _bocListCssClassDefinition);

            renderer.RenderDataCell(
                _bocListRenderingContext,
                new BocListRowRenderingContext(row, 0, false),
                "bocListTableCell");
            var document = Html.GetResultDocument();

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

            Html.AssertAttribute(td, DiagnosticMetadataAttributesForObjectBinding.BocListCellIndex, 1.ToString());
        }
        public string GetControlRowID(BocListRow row)
        {
            ArgumentUtility.CheckNotNull("row", row);

            return(EscapeUniqueIdentifier(((IBusinessObjectWithIdentity)row.BusinessObject).UniqueIdentifier));
        }
        public string GetItemRowID(BocListRow row)
        {
            ArgumentUtility.CheckNotNull("row", row);

            return(FormatItemRowID(row.Index, ((IBusinessObjectWithIdentity)row.BusinessObject).UniqueIdentifier));
        }
        public void Equal_OtherType_AreNotEqual()
        {
            var row = new BocListRow(5, MockRepository.GenerateStub <IBusinessObject>());

            Assert.That(row.Equals(new object()), Is.False);
        }
        public void IEquatable_OtherRowNull_AreNotEqual()
        {
            IEquatable <BocListRow> row = new BocListRow(5, MockRepository.GenerateStub <IBusinessObject>());

            Assert.That(row.Equals(null), Is.False);
        }
Exemple #24
0
 public string GetControlRowID(BocListRow row)
 {
     return(row.Index.ToString());
 }
        public string GetItemRowID(BocListRow row)
        {
            ArgumentUtility.CheckNotNull("row", row);

            return(GetRowID(row));
        }
Exemple #26
0
 public string GetItemRowID(BocListRow row)
 {
     return(row.Index.ToString());
 }
 public void AddRow(BocListRow row)
 {
 }
Exemple #28
0
 public BocListRowMenu(IBocList owner, BocListRow row)
     : base(owner)
 {
     ArgumentUtility.CheckNotNull("row", row);
     _row = row;
 }
 public void RemoveRow(BocListRow row)
 {
 }
 public void RemoveRow(BocListRow row)
 {
     throw new NotSupportedException("The operation is not supported because the value is not set.");
 }