public void CanRemoveFromEmptyList() { var list = new RecentCollection <int>(10); bool removed = list.Remove(int.MaxValue); Assert.IsFalse(removed); Assert.AreEqual(0, list.Count); }
public void CanRemoveNonExistingStringElement() { var list = new RecentCollection <string>(10) { "Neo", "Morpheus", "Trinity", "Agent Smith", "Oracle" }; int oldCount = list.Count; bool removed = list.Remove("There is no spoon"); Assert.IsFalse(removed); Assert.AreEqual(oldCount, list.Count); }
public void CanRemoveNonExistingInt32Element() { var list = new RecentCollection <int>(10) { 1, 2, 3, 4, 5 }; int oldCount = list.Count; bool removed = list.Remove(1024); Assert.IsFalse(removed); Assert.AreEqual(oldCount, list.Count); }
public void CanRemoveLastStringElement() { var list = new RecentCollection <string>(10) { "Neo", "Morpheus", "Trinity", "Agent Smith", "Oracle" }; int oldCount = list.Count; bool removed = list.Remove("Neo"); Assert.IsTrue(removed); Assert.AreEqual(oldCount - 1, list.Count); // TODO: Use SequenceEqual string[] temp = new[] { "Morpheus", "Trinity", "Agent Smith", "Oracle" }.Reverse().ToArray(); for (int i = 0; i < temp.Length; i++) { Assert.AreEqual(temp[i], list[i]); } }
public void CanRemoveMiddleInt32Element() { var list = new RecentCollection <int>(5) { 1, 2, 3, 4, 5 }; int oldCount = list.Count; bool removed = list.Remove(3); Assert.IsTrue(removed); Assert.AreEqual(oldCount - 1, list.Count); // TODO: Use SequenceEqual int[] temp = new[] { 1, 2, 4, 5 }.Reverse().ToArray(); for (int i = 0; i < temp.Length; i++) { Assert.AreEqual(temp[i], list[i]); } }
public void CanRemoveFirstInt32Element() { var list = new RecentCollection<int>(5) {1, 2, 3, 4, 5}; int oldCount = list.Count; bool removed = list.Remove(5); Assert.IsTrue(removed); Assert.AreEqual(oldCount - 1, list.Count); // TODO: Use SequenceEqual int[] temp = new[] { 1, 2, 3, 4 }.Reverse().ToArray(); for (int i = 0; i < temp.Length; i++) { Assert.AreEqual(temp[i], list[i]); } }
public void CanRemoveNonExistingStringElement() { var list = new RecentCollection<string>(10) { "Neo", "Morpheus", "Trinity", "Agent Smith", "Oracle" }; int oldCount = list.Count; bool removed = list.Remove("There is no spoon"); Assert.IsFalse(removed); Assert.AreEqual(oldCount, list.Count); }
public void CanRemoveNonExistingInt32Element() { var list = new RecentCollection<int>(10) { 1, 2, 3, 4, 5 }; int oldCount = list.Count; bool removed = list.Remove(1024); Assert.IsFalse(removed); Assert.AreEqual(oldCount, list.Count); }
public void CanRemoveMiddleStringElement() { var list = new RecentCollection<string>(10) { "Neo", "Morpheus", "Trinity", "Agent Smith", "Oracle" }; int oldCount = list.Count; bool removed = list.Remove("Trinity"); Assert.IsTrue(removed); Assert.AreEqual(oldCount - 1, list.Count); // TODO: Use SequenceEqual string[] temp = new[] { "Neo", "Morpheus", "Agent Smith", "Oracle" }.Reverse().ToArray(); Assert.IsTrue(temp.SequenceEqual(list)); //for (int i = 0; i < temp.Length; i++) //{ // Assert.AreEqual(temp[i], list[i]); //} }
public void CanRemoveFromEmptyList() { var list = new RecentCollection<int>(10); bool removed = list.Remove(int.MaxValue); Assert.IsFalse(removed); Assert.AreEqual(0, list.Count); }