示例#1
0
        private void TestMove(OrderMovement orderMovement)
        {
            //Setup
            var isContiguous = new List <IIsOrdered>();

            for (int i = 0; i < 5; i++)
            {
                isContiguous.Add(new TestSubject {
                    Id = i, Order = i
                });
            }

            var subject = isContiguous[2];

            //Exercise
            IsOrderedHelper.MoveWithinList(isContiguous, subject, orderMovement);

            //Test and assert
            Assert.IsTrue(IsOrderedHelper.IsContiguous(isContiguous));

            if (orderMovement == OrderMovement.Up)
            {
                Assert.IsTrue(subject.Order == 1);
            }
            else
            {
                Assert.IsTrue(subject.Order == 3);
            }
        }
示例#2
0
        public void MovingTheBottomItemDownShallNotThrowAnException()
        {
            //Setup
            var isContiguous = new List <IIsOrdered>();

            for (int i = 0; i < 5; i++)
            {
                isContiguous.Add(new TestSubject {
                    Id = i, Order = i
                });
            }

            var subject = isContiguous[4];

            //Exercise
            IsOrderedHelper.MoveWithinList(isContiguous, subject, OrderMovement.Down);

            //Test and assert
            Assert.IsTrue(IsOrderedHelper.IsContiguous(isContiguous));
            Assert.IsTrue(subject.Order == 4);
        }