Exemple #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);
            }
        }
Exemple #2
0
        public void TestingForIsContiguousShallReturnCorrectly()
        {
            //Setup
            var isContiguous = new List <IIsOrdered>();

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

            var isNotContiguous = new List <IIsOrdered>();

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

            isNotContiguous[2].Order = 100;

            //Exercise and assert
            Assert.IsTrue(IsOrderedHelper.IsContiguous(isContiguous));
            Assert.IsFalse(IsOrderedHelper.IsContiguous(isNotContiguous));
        }
Exemple #3
0
        public void MakingContiguousShallOrderCorrectly()
        {
            //Setup
            var isContiguous = new List <IIsOrdered>();

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

            //Exercise
            IsOrderedHelper.MakeContiguous(isContiguous);

            //Test and assert
            Assert.IsTrue(IsOrderedHelper.IsContiguous(isContiguous));
        }
Exemple #4
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);
        }