예제 #1
0
        public void Enumerator()
        {
            List <int> ints = new List <int> {
                10, 20, 21, 30
            };
            var lookup = new MutableLookup <int, int>(ints.ToLookup(i => Int32.Parse(i.ToString()[0].ToString())));

            Assert.AreEqual(3, lookup.Count());
            Assert.IsTrue(lookup.Any(g => g.Key == 1));
            Assert.IsTrue(lookup.Any(g => g.Key == 2));
            Assert.IsTrue(lookup.Any(g => g.Key == 3));
        }
예제 #2
0
        public void EnumeratorNull()
        {
            var lookup = new MutableLookup <string, string>();

            lookup.Add(null, "blah");
            lookup.Add(null, "monkeys");
            lookup.Add("F", "Foo");
            lookup.Add("F", "Foobar");
            lookup.Add("B", "Bar");

            Assert.AreEqual(3, lookup.Count());
            Assert.IsTrue(lookup.Any(g => g.Key == null));
            Assert.IsTrue(lookup.Any(g => g.Key == "F"));
            Assert.IsTrue(lookup.Any(g => g.Key == "B"));
        }
예제 #3
0
        public void Enumerator()
        {
            List<int> ints = new List<int> { 10, 20, 21, 30 };
            var lookup = new MutableLookup<int, int>(ints.ToLookup(i => Int32.Parse(i.ToString()[0].ToString())));

            Assert.AreEqual (3, lookup.Count());
            Assert.IsTrue (lookup.Any (g => g.Key == 1));
            Assert.IsTrue (lookup.Any (g => g.Key == 2));
            Assert.IsTrue (lookup.Any (g => g.Key == 3));
        }
예제 #4
0
        public void EnumeratorNull()
        {
            var lookup = new MutableLookup<string, string>();
            lookup.Add (null, "blah");
            lookup.Add (null, "monkeys");
            lookup.Add ("F", "Foo");
            lookup.Add ("F", "Foobar");
            lookup.Add ("B", "Bar");

            Assert.AreEqual (3, lookup.Count());
            Assert.IsTrue (lookup.Any (g => g.Key == null));
            Assert.IsTrue (lookup.Any (g => g.Key == "F"));
            Assert.IsTrue (lookup.Any (g => g.Key == "B"));
        }