public void AddTwoItemsAndClear() { var sl = new org.in2bits.MyXls.SortedList<int, string>(); sl.Add(3, "world"); sl.Add(1, "hello"); Assert.AreEqual(2, sl.Count, "List count before clear"); Assert.AreEqual("hello", sl[1]); sl.Clear(); Assert.AreEqual(0, sl.Count); }
public void AddTwoItemsAndClear() { var sl = new org.in2bits.MyXls.SortedList <int, string>(); sl.Add(3, "world"); sl.Add(1, "hello"); Assert.AreEqual(2, sl.Count, "List count before clear"); Assert.AreEqual("hello", sl[1]); sl.Clear(); Assert.AreEqual(0, sl.Count); }
public void AddTwoItemsClearReAddOneWithDifferentKey() { var sl = new org.in2bits.MyXls.SortedList<int, string>(); sl.Add(3, "world"); sl.Add(1, "hello"); Assert.AreEqual(2, sl.Count, "List count before clear"); Assert.AreEqual("hello", sl[1]); sl.Clear(); Assert.AreEqual(0, sl.Count); sl.Add(3, "hello"); Assert.IsFalse(sl.ContainsKey(1), "List item 3 after clear and add"); Assert.AreEqual("hello", sl[3], "List item 3 value after re-add"); }
public void AddTwoItemsClearReAddOneWithDifferentKey() { var sl = new org.in2bits.MyXls.SortedList <int, string>(); sl.Add(3, "world"); sl.Add(1, "hello"); Assert.AreEqual(2, sl.Count, "List count before clear"); Assert.AreEqual("hello", sl[1]); sl.Clear(); Assert.AreEqual(0, sl.Count); sl.Add(3, "hello"); Assert.IsFalse(sl.ContainsKey(1), "List item 3 after clear and add"); Assert.AreEqual("hello", sl[3], "List item 3 value after re-add"); }