Exemplo n.º 1
0
        public void EnumeratorNotNull()
        {
            List <string> strings = new List <string> {
                "hi", "hai", "bai", "bye"
            };
            var lookup = new MutableLookup <string, string> (strings.ToLookup(s => s[0].ToString()));

            Assert.AreEqual(2, lookup.Count);
            Assert.IsTrue(lookup.Any(g => g.Key == "h"));
            Assert.IsTrue(lookup.Any(g => g.Key == "b"));
            Assert.IsFalse(lookup.Any(g => g.Key == null));
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
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"));
        }
Exemplo n.º 4
0
        public void EnumeratorNotNull()
        {
            List<string> strings = new List<string> { "hi", "hai", "bai", "bye" };
            var lookup = new MutableLookup<string, string> (strings.ToLookup (s => s[0].ToString()));

            Assert.AreEqual (2, lookup.Count);
            Assert.IsTrue (lookup.Any (g => g.Key == "h"));
            Assert.IsTrue (lookup.Any (g => g.Key == "b"));
            Assert.IsFalse (lookup.Any (g => g.Key == null));
        }
Exemplo n.º 5
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));
        }
Exemplo n.º 6
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"));
        }