Beispiel #1
0
        public void EditableLookupAddRangeKey()
        {
            var lookup = new EditableLookup<string, int>();
            lookup.Add("a", 1);
            lookup.Add("b", 2);
            // add to existing key
            lookup.AddRange("a", new int[] { 3, 4, 5 });
            // add to new key
            lookup.AddRange("c", new int[] { 6, 7});

            Assert.AreEqual(3, lookup.Count);
            Assert.AreEqual(13, lookup["a"].Sum());
            Assert.AreEqual(13, lookup["c"].Sum());
        }
        public void EditableLookupAddRangeKey()
        {
            var lookup = new EditableLookup <string, int>();

            lookup.Add("a", 1);
            lookup.Add("b", 2);
            // add to existing key
            lookup.AddRange("a", new int[] { 3, 4, 5 });
            // add to new key
            lookup.AddRange("c", new int[] { 6, 7 });

            Assert.AreEqual(3, lookup.Count);
            Assert.AreEqual(13, lookup["a"].Sum());
            Assert.AreEqual(13, lookup["c"].Sum());
        }
        private IEnumerable <KeyValuePair <string, int?> > GetPipelineSample()
        {
            var lookup = new EditableLookup <string, int?>();

            lookup.AddRange("foo", new int?[] { 1, 1, null, 1 });
            lookup.AddRange("bar", new int?[] { 2, 2, 2 });
            lookup.AddRange("test", new int?[] { 9, null, 3 });
            foreach (var group in lookup)
            {
                foreach (var item in group)
                {
                    yield return(new KeyValuePair <string, int?>(group.Key, item));
                }
            }
        }
Beispiel #4
0
        public void EditableLookupAddRangeNullKey()
        {
            var lookup             = new EditableLookup <string, int>();
            IEnumerable <int> mate = null;

            lookup.AddRange("foo", mate);
        }
Beispiel #5
0
        public void EditableLookupAddRangeNullLookup()
        {
            var lookup = new EditableLookup <string, int>();
            ILookup <string, int> mate = null;

            lookup.AddRange(mate);
        }
        public void EditableLookupAddRangeLookup()
        {
            var lookup = new EditableLookup <string, int>();

            lookup.Add("a", 1);
            lookup.Add("b", 2);

            var lookup2 = new EditableLookup <string, int>();

            lookup2.AddRange("a", new int[] { 3, 4, 5 });
            lookup2.AddRange("c", new int[] { 6, 7 });

            lookup.AddRange(lookup2);

            Assert.AreEqual(3, lookup.Count);
            Assert.AreEqual(13, lookup["a"].Sum());
            Assert.AreEqual(13, lookup["c"].Sum());
        }
 public void EditableLookupAddRangeNullKey()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         var lookup             = new EditableLookup <string, int>();
         IEnumerable <int> mate = null;
         lookup.AddRange("foo", mate);
     });
 }
 public void EditableLookupAddRangeNullLookup()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         var lookup = new EditableLookup <string, int>();
         ILookup <string, int> mate = null;
         lookup.AddRange(mate);
     });
 }
Beispiel #9
0
 public void EditableLookupAddRangeEmptyKey()
 {
     var lookup = new EditableLookup<string, int>();
     int[] data = new int[0];
     lookup.Add("foo", 1);
     Assert.AreEqual(1, lookup.Count);
     lookup.AddRange("bar", data);
     // want to check that empty insert hasn't left
     // a rogue group
     Assert.AreEqual(1, lookup.Count);
     Assert.IsFalse(lookup.Contains("bar"));
 }
        public void EditableLookupAddRangeEmptyKey()
        {
            var lookup = new EditableLookup <string, int>();

            int[] data = new int[0];
            lookup.Add("foo", 1);
            Assert.AreEqual(1, lookup.Count);
            lookup.AddRange("bar", data);
            // want to check that empty insert hasn't left
            // a rogue group
            Assert.AreEqual(1, lookup.Count);
            Assert.IsFalse(lookup.Contains("bar"));
        }
Beispiel #11
0
        public void EditableLookupAddRangeLookup()
        {
            var lookup = new EditableLookup<string, int>();
            lookup.Add("a", 1);
            lookup.Add("b", 2);

            var lookup2 = new EditableLookup<string, int>();
            lookup2.AddRange("a", new int[] { 3, 4, 5 });
            lookup2.AddRange("c", new int[] { 6, 7 });

            lookup.AddRange(lookup2);

            Assert.AreEqual(3, lookup.Count);
            Assert.AreEqual(13, lookup["a"].Sum());
            Assert.AreEqual(13, lookup["c"].Sum());
        }
Beispiel #12
0
 public void EditableLookupAddRangeNullKey()
 {
     var lookup = new EditableLookup<string, int>();
     IEnumerable<int> mate = null;
     lookup.AddRange("foo", mate);
 }
Beispiel #13
0
 public void EditableLookupAddRangeNullLookup()
 {
     var lookup = new EditableLookup<string, int>();
     ILookup<string, int> mate = null;
     lookup.AddRange(mate);
 }