示例#1
0
        public void CanAddAndRetrieveAnElement()
        {
            var list = new MostRecentList <string>();

            list.AddUsage("a");
            CollectionAssert.AreEqual(new[] { "a" }, list.GetMostRecentValues());
        }
示例#2
0
        public void DuplicateAddsOnlyReturnedOnce()
        {
            var list = new MostRecentList <string>(3);

            list.AddUsage("c");
            list.AddUsage("d");
            list.AddUsage("e");
            list.AddUsage("d");
            CollectionAssert.AreEqual(new[] { "d", "e", "c" }, list.GetMostRecentValues());
        }
示例#3
0
        public void ExcessElementsAreRemoved()
        {
            var list = new MostRecentList <string>(3);

            list.AddUsage("a");
            list.AddUsage("b");
            list.AddUsage("c");
            list.AddUsage("d");
            list.AddUsage("e");
            CollectionAssert.AreEqual(new[] { "e", "d", "c" }, list.GetMostRecentValues());
        }
示例#4
0
        public void ElementsReturnedInReverseOrderOfAdding()
        {
            var list = new MostRecentList <string>();

            list.AddUsage("a");
            list.AddUsage("b");
            list.AddUsage("c");
            list.AddUsage("d");
            list.AddUsage("e");
            CollectionAssert.AreEqual(new[] { "e", "d", "c", "b", "a" }, list.GetMostRecentValues());
        }