public void GetValuesForKey2()
        {
            DoubleKeyMultiDictionary <string, string, int> dictionary = new DoubleKeyMultiDictionary <string, string, int>();

            dictionary.Add("k1", "k2", 10);
            dictionary.Add("k3", "k2", 20);

            Assert.AreEqual(2, dictionary.GetValuesForKey2("k2").Count());
            Assert.IsTrue(dictionary.GetValuesForKey2("k2").Contains(new KeyValuePair <string, int>("k1", 10)));
            Assert.IsTrue(dictionary.GetValuesForKey2("k2").Contains(new KeyValuePair <string, int>("k3", 20)));
        }
        public void Add()
        {
            DoubleKeyMultiDictionary <string, string, int> dictionary = new DoubleKeyMultiDictionary <string, string, int>();

            dictionary.Add("k1", "k2", 10);

            Assert.AreEqual(1, dictionary.Count);
            Assert.AreEqual(10, dictionary.GetValues("k1", "k2").First());

            Assert.AreEqual("k2", dictionary.GetValuesForKey1("k1").First().Key);
            Assert.AreEqual(10, dictionary.GetValuesForKey1("k1").First().Value);

            Assert.AreEqual("k1", dictionary.GetValuesForKey2("k2").First().Key);
            Assert.AreEqual(10, dictionary.GetValuesForKey2("k2").First().Value);
        }
Ejemplo n.º 3
0
        public IEnumerable <DirectedEdge <V, E> > GetEdgesGoingTo(V to)
        {
            IEnumerable <DirectedEdge <V, E> > result = myEdges.GetValuesForKey2(to).Select(x => x.Value);

            return(result);
        }