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

            // add key/value pair, ensure it did not exist before
            Assert.IsTrue(dictionarySet.Add(FOO, BAR), "FOO/BAR existed when adding to empty DictionarySet");
            // ensure key/value pair exists
            Assert.IsTrue(dictionarySet.ContainsValue(FOO, BAR), "FOO/BAR did not exist after being added to DictionarySet (function)");
            Assert.IsTrue(dictionarySet[FOO, BAR], "FOO/BAR did not exist after being added to DictionarySet (getter)");
            // ensure inverse pair doesn't exist
            Assert.IsFalse(dictionarySet.ContainsValue(BAR, FOO), "BAR/FOO existed before being added to DictionarySet (function)");
            Assert.IsFalse(dictionarySet[BAR, FOO], "BAR/FOO existed before being added to DictionarySet (getter)");
            // add inverse key/value pair, ensure it did not exist before
            Assert.IsTrue(dictionarySet.Add(BAR, FOO), "BAR/FOO existed upon first add to DictionaryList");
            // ensure inverse pair now exists
            Assert.IsTrue(dictionarySet.ContainsValue(BAR, FOO), "BAR/FOO did not exist after being added to DictionaryList (function)");
            Assert.IsTrue(dictionarySet[BAR, FOO], "BAR/FOO did not exist after being added to DictionaryList (getter)");
        }