Exemplo n.º 1
0
        public void TestDictionarySetContainKeys()
        {
            DictionarySet <int, int> dictionarySet = new DictionarySet <int, int>();

            // check that keys do not exist in empty DictionarySet
            Assert.IsFalse(dictionarySet.ConatinsKey(FOO), "Key FOO existed in empty DictionarySet");
            Assert.IsFalse(dictionarySet.ConatinsKey(BAR), "Key BAR existed in empty DictionarySet");

            // add key/value pair, ensure it did not exist before
            Assert.IsTrue(dictionarySet.Add(FOO, BAR), "FOO/BAR existed when adding to empty DictionarySet");
            // check that key exists
            Assert.IsTrue(dictionarySet.ConatinsKey(FOO), "Key FOO did not exist after adding FOO/BAR to DictionarySet");

            // check that wrong key does not exist
            Assert.IsFalse(dictionarySet.ConatinsKey(BAR), "Key BAR exists in DictionarySet before added");

            // add inverse key/value pair, ensure it did not exist before
            Assert.IsTrue(dictionarySet.Add(BAR, FOO), "BAR/FOO existed when adding to DictionarySet that did not contain them");
            // check that inverse key now exists
            Assert.IsTrue(dictionarySet.ConatinsKey(BAR), "Key BAR did not exist after adding BAR/FOO to DictionarySet");
        }