public void KeyAlreadyExists()
            {
                var source = new List <TestModel>()
                {
                    new TestModel()
                    {
                        Id = 1,
                    },
                    new TestModel()
                    {
                        Id = 2,
                    },
                    new TestModel()
                    {
                        Id = 3,
                    },
                };
                var target = new Dictionary <int, object>();

                target.Add(1, new TestModel()
                {
                    Id = 1,
                });
                GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, s => s);
            }
            public void Works()
            {
                var source = new List <TestModel>()
                {
                    new TestModel()
                    {
                        Id = 1,
                    },
                    new TestModel()
                    {
                        Id = 2,
                    },
                    new TestModel()
                    {
                        Id = 3,
                    },
                };
                var target = new Dictionary <int, TestModel>();

                GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, s => s);

                Assert.AreEqual(3, target.Count);
                Assert.IsTrue(target.ContainsKey(1));
                Assert.IsTrue(target.ContainsKey(2));
                Assert.IsTrue(target.ContainsKey(3));
                Assert.AreSame(source[0], target[1]);
                Assert.AreSame(source[1], target[2]);
                Assert.AreSame(source[2], target[3]);
            }
            public void ThrowsIfNullArg3()
            {
                List <TestModel> source = new List <TestModel>();
                var target = new Dictionary <int, object>();

                GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, null);
            }
            public void ThrowsIfNullArg0()
            {
                List <TestModel>         source = new List <TestModel>();
                Dictionary <int, object> target = null;

                GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, s => s.Name);
            }
            public void Generic_KeyNotFound_ReturnsNull()
            {
                var key = "key";
                IDictionary <string, object> dictionary = new Dictionary <string, object>();
                var result = GSrkIDictionaryExtensions.GetValue(dictionary, key);

                Assert.IsNull(result);
            }
            public void Generic_NullValue()
            {
                object value = null;
                var    key   = "key";
                IDictionary <string, object> dictionary = new Dictionary <string, object>();

                dictionary.Add(key, value);
                var result = GSrkIDictionaryExtensions.GetValue(dictionary, key);

                Assert.IsNull(result);
            }
            public void Generic_ReturnsStoredValue()
            {
                var value = new object();
                var key   = "key";
                IDictionary <string, object> dictionary = new Dictionary <string, object>();

                dictionary.Add(key, value);
                var result = GSrkIDictionaryExtensions.GetValue(dictionary, key);

                Assert.AreSame(value, result);
            }