public void Latest_recent_is_last() { var list = new RecentlyUsedList(); list.Add(25); list.Add(32); Assert.AreEqual(25, list.Last()); }
public void Most_recent_is_first() { var list = new RecentlyUsedList(); list.Add(25); list.Add(32); Assert.AreEqual(32, list.First()); }
public void Add_WhenItemAdded_ShouldReturnItFirst() { var list = new RecentlyUsedList <int>(); list.Add("someId", 123); list.Add("someId2", 124); list[0].ShouldBe(("someId2", 124)); }
public void Add_WhenCalledTwiceWithTheSameId_ShoudContainSecondItem() { var list = new RecentlyUsedList <int>(); list.Add("someId", 123); list.Add("someId", 124); list[0].ShouldBe(("someId", 124)); }
public void Add_WhenCalledTwiceWithSameValues_ShouldOnlyAddOne() { var list = new RecentlyUsedList <int>(); list.Add("someId", 123); list.Add("someId", 123); list.Count.ShouldBe(1); }
public void Add_WhenCalledTwiceWithDifferentValues_ShouldContainTwoItems() { var list = new RecentlyUsedList <int>(); list.Add("someId", 123); list.Add("secondId", 123); list.Count.ShouldBe(2); }
public void Items_are_unique() { var list = new RecentlyUsedList(); list.Add(25); list.Add(67); list.Add(25); list.Add(25); Assert.AreEqual(25, list.Index(0)); Assert.AreEqual(67, list.Index(1)); }
public void duplicate_insertions_are_moved() { var list = new RecentlyUsedList(); list.Add(25); list.Add(67); Assert.AreEqual(67, list.Index(0)); Assert.AreEqual(25, list.Index(1)); list.Add(25); Assert.AreEqual(25, list.Index(0)); Assert.AreEqual(67, list.Index(1)); }
public void Capacity_set_in_constructor_item_dropped_on_overflow() { var list = new RecentlyUsedList(3); list.Add(33); list.Add(67); list.Add(87); list.Add(55); list.Add(88); Assert.AreEqual(87, list.Index(0)); Assert.AreEqual(67, list.Index(1)); Assert.AreEqual(33, list.Index(2)); }
public void Items_accessed_by_index() { var list = new RecentlyUsedList(); list.Add(25); list.Add(32); list.Add(67); list.Add(13); Assert.AreEqual(13, list.Index(0)); Assert.AreEqual(67, list.Index(1)); Assert.AreEqual(32, list.Index(2)); Assert.AreEqual(25, list.Index(3)); }
public void Add_WhenFirstItemAdded_ReturnsTheAddedItemId() { var list = new RecentlyUsedList <int>(); list.Add("someId", 123); list[0].Id.ShouldBe("someId"); }
public void Add_WhenCalledOnce_ShouldReturnAddedItem() { var list = new RecentlyUsedList <int>(); list.Add("someId", 123); list[0].Value.ShouldBe(123); }
public void Add_AddsAValue_ShouldIncrementTheCount() { _testee.Add(EnteredNumber); _testee.Count.Should().Be(1); }