Beispiel #1
0
        public void Initial()
        {
            bool res;

            Assert.IsFalse(dict.IsReadOnly);

            Assert.AreEqual(dict.Count, 0, "new dict should be empty");
            dict.Add("A", "B");
            Assert.AreEqual(dict.Count, 1, "bad count");
            Assert.AreEqual(dict["A"], "B", "Wrong value for dict[A]");
            dict.Add("C", "D");
            Assert.AreEqual(dict.Count, 2, "bad count");
            Assert.AreEqual(dict["A"], "B", "Wrong value");
            Assert.AreEqual(dict["C"], "D", "Wrong value");
            res = dict.Remove("A");
            Assert.IsTrue(res, "bad return value from Remove(A)");
            Assert.IsTrue(dict.Check());
            Assert.AreEqual(dict.Count, 1, "bad count");
            Assert.AreEqual(dict["C"], "D", "Wrong value of dict[C]");
            res = dict.Remove("Z");
            Assert.IsFalse(res, "bad return value from Remove(Z)");
            Assert.AreEqual(dict.Count, 1, "bad count");
            Assert.AreEqual(dict["C"], "D", "Wrong value of dict[C] (2)");
            dict.Clear();
            Assert.AreEqual(dict.Count, 0, "dict should be empty");
        }