예제 #1
0
 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);
 }
예제 #2
0
        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);
        }
예제 #3
0
 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");
 }
예제 #4
0
        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");
        }