コード例 #1
0
        public void RemoveRow()
        {
            var rowIDProvider = new IndexBasedRowIDProvider(new IBusinessObject[6]);

            rowIDProvider.RemoveRow(new BocListRow(3, CreateObject()));

            Assert.That(rowIDProvider.GetItemRowID(new BocListRow(2, CreateObject())), Is.EqualTo("2"));
            Assert.That(rowIDProvider.GetItemRowID(new BocListRow(3, CreateObject())), Is.EqualTo("4"));
            Assert.That(rowIDProvider.GetItemRowID(new BocListRow(4, CreateObject())), Is.EqualTo("5"));
        }
コード例 #2
0
        public void AddRow_AtMiddleOfList()
        {
            var rowIDProvider = new IndexBasedRowIDProvider(new IBusinessObject[6]);

            rowIDProvider.AddRow(new BocListRow(3, CreateObject()));

            Assert.That(rowIDProvider.GetItemRowID(new BocListRow(2, CreateObject())), Is.EqualTo("2"));
            Assert.That(rowIDProvider.GetItemRowID(new BocListRow(3, CreateObject())), Is.EqualTo("6"));
            Assert.That(rowIDProvider.GetItemRowID(new BocListRow(4, CreateObject())), Is.EqualTo("3"));
            Assert.That(rowIDProvider.GetItemRowID(new BocListRow(5, CreateObject())), Is.EqualTo("4"));
            Assert.That(rowIDProvider.GetItemRowID(new BocListRow(6, CreateObject())), Is.EqualTo("5"));
        }
コード例 #3
0
        public void GetItemRowID_BeyondEndOfList()
        {
            var rowIDProvider = new IndexBasedRowIDProvider(new IBusinessObject[6]);

            Assert.That(
                () => rowIDProvider.GetItemRowID(new BocListRow(6, CreateObject())),
                Throws.InvalidOperationException
                .With.Message.StartsWith("Tried to retrieve the ID for the row at index 6 but the current length of the row collection is 6."));
        }
コード例 #4
0
        public void GetItemRowID_GetRowFromItemRowID()
        {
            var rowIDProvider = new IndexBasedRowIDProvider(new IBusinessObject[3]);
            var rowID         = rowIDProvider.GetItemRowID(new BocListRow(1, CreateObject()));

            var values = new[]
            {
                CreateObject(),
                CreateObject(),
                CreateObject()
            };

            var row = rowIDProvider.GetRowFromItemRowID(values, rowID);

            Assert.That(row.Index, Is.EqualTo(1));
            Assert.That(row.BusinessObject, Is.SameAs(values[1]));
        }
コード例 #5
0
        public void GetItemRowID()
        {
            var rowIDProvider = new IndexBasedRowIDProvider(new IBusinessObject[6]);

            Assert.That(rowIDProvider.GetItemRowID(new BocListRow(3, CreateObject())), Is.EqualTo("3"));
        }