Exemplo n.º 1
0
        public virtual void Test_ResetBOCol_ResetsItems()
        {
            //---------------Set up test pack-------------------
            IBOColSelectorControl     colSelector = CreateSelector();
            IBusinessObject           bo;
            IBusinessObjectCollection collection = GetCollectionWithTowBOs(out bo);
            IBusinessObject           newMyBO    = collection[1];

            colSelector.BusinessObjectCollection = collection;
            //---------------Assert Precondition----------------
            Assert.AreEqual(ActualNumberOfRows(collection.Count), colSelector.NoOfItems, "The blank item and one other");
            Assert.AreSame(bo, colSelector.GetBusinessObjectAtRow(ActualIndex(0)));
            Assert.AreSame(newMyBO, colSelector.GetBusinessObjectAtRow(ActualIndex(1)));
            //---------------Execute Test ----------------------
            colSelector.BusinessObjectCollection = GetCollectionWithNoItems();
            //---------------Test Result -----------------------
            Assert.AreEqual(ActualNumberOfRows(0), colSelector.NoOfItems, "The blank item ");
            Assert.IsNull(colSelector.SelectedBusinessObject);
        }
Exemplo n.º 2
0
        public virtual void Test_AddBOToCol_UpdatesItems()
        {
            //---------------Set up test pack-------------------
            IBOColSelectorControl     colSelector = CreateSelector();
            IBusinessObject           bo;
            IBusinessObjectCollection collection = GetCollectionWithOneBO(out bo);

            colSelector.BusinessObjectCollection = collection;
            //---------------Assert Precondition----------------
            Assert.AreSame(collection, colSelector.BusinessObjectCollection);
            Assert.AreEqual(ActualNumberOfRows(collection.Count), colSelector.NoOfItems, "The blank item and one other");
            //---------------Execute Test ----------------------
            IBusinessObject newBO = CreateNewBO();

            collection.Add(newBO);
            //---------------Test Result -----------------------
            Assert.AreEqual(ActualNumberOfRows(2), colSelector.NoOfItems, "The blank item and one other");
            Assert.AreSame(bo, colSelector.GetBusinessObjectAtRow(ActualIndex(0)));
            Assert.AreSame(newBO, colSelector.GetBusinessObjectAtRow(ActualIndex(1)));
        }
        public override void Test_RemoveBOToCol_UpdatesItems()
        {
            //---------------Set up test pack-------------------
            IBOColSelectorControl colSelector = CreateSelector();
            MyBO myBO    = new MyBO();
            MyBO newMyBO = new MyBO();
            BusinessObjectCollection <MyBO> collection = new BusinessObjectCollection <MyBO> {
                myBO, newMyBO
            };

            colSelector.BusinessObjectCollection = collection;
            //---------------Assert Precondition----------------
            Assert.AreEqual
                (collection.Count + NumberOfLeadingBlankRows(), colSelector.NoOfItems, "The blank item and one other");
            Assert.AreSame(myBO, colSelector.GetBusinessObjectAtRow(ActualIndex(0)));
            Assert.AreSame(newMyBO, colSelector.GetBusinessObjectAtRow(ActualIndex(1)));
            //---------------Execute Test ----------------------
            collection.Remove(myBO);
            //---------------Test Result -----------------------
            Assert.AreEqual(ActualNumberOfRows(1), colSelector.NoOfItems, "The blank item and one other");
            Assert.AreSame(newMyBO, colSelector.GetBusinessObjectAtRow(ActualIndex(0)));
        }
Exemplo n.º 4
0
        public virtual void Test_GetBusinessObjectAtRow_GTNoRows_ReturnsNull()
        {
            //---------------Set up test pack-------------------
            IBOColSelectorControl     colSelector = CreateSelector();
            IBusinessObject           bo;
            IBusinessObjectCollection collection = GetCollectionWithOneBO(out bo);

            colSelector.BusinessObjectCollection = collection;
            //---------------Assert Precondition----------------
            Assert.AreSame(collection, colSelector.BusinessObjectCollection);
            Assert.AreEqual(ActualNumberOfRows(collection.Count), colSelector.NoOfItems, "The blank item and one other");
            //---------------Execute Test ----------------------
            IBusinessObject businessObjectAtRow = colSelector.GetBusinessObjectAtRow(ActualIndex(1));

            //---------------Test Result -----------------------
            Assert.IsNull(businessObjectAtRow);
        }