コード例 #1
0
        public void Previous_ShouldReturnPreviousIndex()
        {
            // Assign
            var list = new CircularList<int>(GetNumbers());

            // Act
            int current = list.Current;
            int next0 = list.Previous();
            int next1 = list.Previous();
            int next2 = list.Previous();
            int next3 = list.Previous();
            int next4 = list.Previous();
            int next5 = list.Previous();
            int next6 = list.Previous();

            // Assert
            Assert.AreEqual(0, current);
            Assert.AreEqual(4, next0);
            Assert.AreEqual(3, next1);
            Assert.AreEqual(2, next2);
            Assert.AreEqual(1, next3);
            Assert.AreEqual(0, next4);
            Assert.AreEqual(4, next5);
            Assert.AreEqual(3, next6);
        }