示例#1
0
        public void Test_Insert_WhenIndexNegative_AddsItemToBeginOfList()
        {
            //---------------Set up test pack-------------------
            UIFormColumn column = new UIFormColumn();
            UIFormField  field  = GetNewFormField();

            column.Insert(0, GetNewFormField());
            //---------------Assert Precondition----------------
            Assert.AreEqual(1, column.Count);
            Assert.AreNotSame(field, column[0]);
            //---------------Execute Test ----------------------
            column.Insert(-1, field);
            //---------------Test Result -----------------------
            Assert.AreEqual(2, column.Count);
            Assert.AreSame(field, column[0]);
        }
示例#2
0
        public void Test_Insert_WhenOneItem_ShouldInsertFieldAtIndex()
        {
            //---------------Set up test pack-------------------
            UIFormColumn column = new UIFormColumn();
            UIFormField  field  = GetNewFormField();

            column.Insert(0, GetNewFormField());
            //---------------Assert Precondition----------------
            Assert.AreEqual(1, column.Count);
            Assert.AreNotSame(field, column[0]);
            //---------------Execute Test ----------------------
            column.Insert(0, field);
            //---------------Test Result -----------------------
            Assert.AreEqual(2, column.Count);
            Assert.AreSame(field, column[0]);
        }
示例#3
0
        public void Test_Insert_WhenFieldAlreadyExists_DoesNothing()
        {
            //---------------Set up test pack-------------------
            UIFormColumn column = new UIFormColumn();
            UIFormField  field  = GetNewFormField();

            column.Insert(0, field);
            //---------------Assert Precondition----------------
            Assert.AreEqual(1, column.Count);
            Assert.AreSame(field, column[0]);
            //---------------Execute Test ----------------------
            column.Insert(0, field);
            //---------------Test Result -----------------------
            Assert.AreEqual(1, column.Count);
            Assert.AreSame(field, column[0]);
        }
示例#4
0
        public void Test_Insert_WhenNoItems_ShouldInsertInfirstLocation()
        {
            //---------------Set up test pack-------------------
            UIFormColumn column = new UIFormColumn();
            UIFormField  field  = GetNewFormField();

            //---------------Assert Precondition----------------
            Assert.AreEqual(0, column.Count);
            //---------------Execute Test ----------------------
            column.Insert(0, field);
            //---------------Test Result -----------------------
            Assert.AreEqual(1, column.Count);
            Assert.AreSame(field, column[0]);
            Assert.AreSame(column, field.UIFormColumn);
        }