public void TraceTest()
        {
            var t = new List <IDictionary <string, string> >(_3.TraceKey("all"));

            Assert.AreEqual(3, t.Count);
            Assert.AreEqual(_3, t[0]);
            Assert.AreEqual(_2, t[1]);
            Assert.AreEqual(_1, t[2]);

            t = new List <IDictionary <string, string> >(_3.TraceKey("a"));
            Assert.AreEqual(2, t.Count);
            Assert.AreEqual(_3, t[0]);
            Assert.AreEqual(_1, t[1]);

            t = new List <IDictionary <string, string> >(_3.TraceKey("b"));
            Assert.AreEqual(2, t.Count);
            Assert.AreEqual(_2, t[0]);
            Assert.AreEqual(_1, t[1]);

            t = new List <IDictionary <string, string> >(_3.TraceKey("c"));
            Assert.AreEqual(2, t.Count);
            Assert.AreEqual(_3, t[0]);
            Assert.AreEqual(_2, t[1]);

            t = new List <IDictionary <string, string> >(_3.TraceKey("d"));
            Assert.AreEqual(0, t.Count);

            Assert.AreEqual("1", _1["all"]);
            Assert.AreEqual("2", _2["all"]);
            Assert.AreEqual("3", _3["all"]);

            Assert.AreEqual("3a", _3["a"]);
            Assert.AreEqual("2b", _3["b"]);
            Assert.AreEqual("3c", _3["c"]);

            Assert.AreEqual("1a", _2["a"]);
            Assert.AreEqual("2b", _2["b"]);
            Assert.AreEqual("2c", _2["c"]);

            Assert.AreEqual("1a", _1["a"]);
            Assert.AreEqual("1b", _1["b"]);
            Assert.IsFalse(_1.ContainsKey("c"));

            Assert.IsTrue(_2.ContainsKey("a"));
            Assert.IsTrue(_2.ContainsKey("b"));
            Assert.IsTrue(_2.ContainsKey("c"));
            Assert.IsFalse(_2.ContainsKeyShallow("a"));
            Assert.IsTrue(_2.ContainsKeyShallow("b"));
            Assert.IsTrue(_2.ContainsKeyShallow("c"));

            Assert.IsTrue(_3.ContainsKey("a"));
            Assert.IsTrue(_3.ContainsKey("b"));
            Assert.IsTrue(_3.ContainsKey("c"));
            Assert.IsTrue(_3.ContainsKeyShallow("a"));
            Assert.IsFalse(_3.ContainsKeyShallow("b"));
            Assert.IsTrue(_3.ContainsKeyShallow("c"));
        }
        public void NoEncapsulationTest()
        {
            var ed = new EncapsulatingDictionary <string, string>();

            ed["name"] = "anne";
            ed["age"]  = "82";

            Assert.AreEqual(2, ed.Count);
            Assert.AreEqual(ed.ShallowCount, ed.DeepCount);
            Assert.AreEqual(1, ed.Depth);

            Assert.AreEqual("anne", ed["name"]);
            Assert.AreEqual("82", ed["age"]);

            ed.Add("city", "syrupville");
            Assert.AreEqual(3, ed.Count);
            Assert.AreEqual(ed.ShallowCount, ed.DeepCount);
            Assert.AreEqual(1, ed.Depth);
            Assert.IsTrue(ed.ContainsKey("name"));
            Assert.IsTrue(ed.ContainsKey("age"));
            Assert.IsTrue(ed.ContainsKey("city"));
            Assert.IsFalse(ed.ContainsKey("state"));


            Assert.IsFalse(ed.Remove("state"));
            Assert.AreEqual(3, ed.Count);
            Assert.AreEqual(ed.ShallowCount, ed.DeepCount);
            Assert.AreEqual(1, ed.Depth);

            Assert.IsTrue(ed.Remove("age"));
            Assert.AreEqual(2, ed.Count);
            Assert.AreEqual(ed.ShallowCount, ed.DeepCount);
            Assert.AreEqual(1, ed.Depth);


            ed.Clear();
            Assert.AreEqual(0, ed.Count);
            Assert.AreEqual(ed.ShallowCount, ed.DeepCount);
            Assert.AreEqual(1, ed.Depth);
        }