Ejemplo n.º 1
0
        public void Add()
        {
            MultiKeyDistinctValueDictionary <string, string> dictionary = new MultiKeyDistinctValueDictionary <string, string>();

            dictionary.Add("1", "2");
            Assert.AreEqual(1, dictionary.Count);
            Assert.IsTrue(dictionary.ContainsKey("1"));
            Assert.IsTrue(dictionary.Contains("1", "2"));
            Assert.AreEqual("2", dictionary["1"].First());

            dictionary.Add("1", "2");
            Assert.AreEqual(1, dictionary.Count);

            dictionary.Add("1", "3");
            Assert.AreEqual(2, dictionary.Count);
            Assert.IsTrue(dictionary.ContainsKey("1"));
            Assert.IsTrue(dictionary.Contains("1", "2"));
            Assert.IsTrue(dictionary.Contains("1", "3"));

            dictionary.Add("2", "1");
            Assert.AreEqual(3, dictionary.Count);
            Assert.IsTrue(dictionary.ContainsKey("1"));
            Assert.IsTrue(dictionary.ContainsKey("2"));
            Assert.IsTrue(dictionary.Contains("1", "2"));
            Assert.IsTrue(dictionary.Contains("1", "3"));
            Assert.IsTrue(dictionary.Contains("2", "1"));
        }
Ejemplo n.º 2
0
        public void Add_Sequence()
        {
            MultiKeyDistinctValueDictionary <string, string> dictionary = new MultiKeyDistinctValueDictionary <string, string>();

            dictionary.Add("1", new List <string>()
            {
                "2", "3"
            });
            Assert.AreEqual(2, dictionary.Count);
            Assert.IsTrue(dictionary.ContainsKey("1"));
            Assert.IsTrue(dictionary.Contains("1", "2"));
            Assert.IsTrue(dictionary.Contains("1", "3"));
        }