public void StiListHasTheRightCountValue()
        {
            var initializerList = GetRandomItemsList();
            var sliList = new SliList(initializerList);

            Assert.AreEqual(initializerList.Count(), sliList.Count);
        }
        public void GetNumberWrongPosition_TooSmall()
        {
            var initializerList = GetRandomItemsList();
            var sliList = new SliList(initializerList);

            sliList.GetNumber(-1);
        }
        public void GetNumberWrongPosition_TooBig()
        {
            var initializerList = GetRandomItemsList();
            var sliList = new SliList(initializerList);

            sliList.GetNumber(sliList.Count);
        }
        public void GetNumberReturnsTheRightValue()
        {
            var initializerList = GetRandomItemsList();
            var sliList = new SliList(initializerList);

            for (int j = 0; j < initializerList.Count(); j++)
            {
                Assert.AreEqual(initializerList[j], sliList.GetNumber(j));
            }
        }
        public void GivenAListAndPositionReturnTheRightValue()
        {
            var list = new SliList(new List<int> { 82, 55, 78, 92, 12, 44, 51 });

            Assert.AreEqual(51, GetListItems.GetListItems.GetNthPositionFromLast(list, 1));
            Assert.AreEqual(44, GetListItems.GetListItems.GetNthPositionFromLast(list, 2));
            Assert.AreEqual(12, GetListItems.GetListItems.GetNthPositionFromLast(list, 3));
            Assert.AreEqual(92, GetListItems.GetListItems.GetNthPositionFromLast(list, 4));
            Assert.AreEqual(78, GetListItems.GetListItems.GetNthPositionFromLast(list, 5));
            Assert.AreEqual(55, GetListItems.GetListItems.GetNthPositionFromLast(list, 6));
            Assert.AreEqual(82, GetListItems.GetListItems.GetNthPositionFromLast(list, 7));
        }
        public void StiListCorrectlyInitialized()
        {
            var initializerList = GetRandomItemsList();
            var sliList = new SliList(initializerList);

            Assert.AreEqual(initializerList.First(), sliList.First.Number);
            Assert.AreEqual(initializerList.Last(), sliList.Last.Number);

            var currentSliItem = sliList.First;
            foreach (var item in initializerList)
            {
                Assert.AreEqual(item, currentSliItem.Number);
                currentSliItem = currentSliItem.Next;
            }
        }
 public static int GetNthPositionFromLast(SliList list, int wantedPositionFromLast)
 {
     var numerOfItems = list.Count;
     var positionNeeded = numerOfItems - wantedPositionFromLast;
     return list.GetNumber(positionNeeded);
 }