예제 #1
0
        public void ShouldReturnZeroWhenCountItemsIsCalledForInitialList()
        {
            RecentlyUsedList<int> ListObject = new RecentlyUsedList<int>(5);

            int countItems=ListObject.CountItems();

            Assert.AreEqual(0, countItems, "Initially The list is not Empty.");
        }
예제 #2
0
        public void ShouldReturnThreeWhenCountItemsIsCalledAfterEightIsAddedAgainAndEightShouldBeTheFirstElement()
        {
            RecentlyUsedList<char> ListObject = new RecentlyUsedList<char>(5);

            ListObject.AddItem('m');
            ListObject.AddItem('a');
            ListObject.AddItem('c');
            ListObject.AddItem('a');

            int countItems = ListObject.CountItems();

            Assert.AreEqual(3, countItems, "The size of list is not Three");
            Assert.AreEqual('a', ListObject[0], "a is not the first item.");
        }
예제 #3
0
        public void ShouldReturnAtreyAsFirstItemAndEightAsLastItemIfAtreyIsAddedAfterListSizeIsFull()
        {
            RecentlyUsedList<int> ListObject = new RecentlyUsedList<int>(5);

            ListObject.AddItem(11);
            ListObject.AddItem(8);
            ListObject.AddItem(6);
            ListObject.AddItem(4);
            ListObject.AddItem(13);
            ListObject.AddItem(32);

            var firstItem = ListObject[0];
            var lastItem = ListObject[4];
            int countItems = ListObject.CountItems();

            Assert.AreEqual(32,firstItem , "The First item is not 32.");
            Assert.AreEqual(8, lastItem, "The last item is not 8.");
            Assert.AreEqual(5, countItems, "The size of list is not five");
        }