コード例 #1
0
        public void NonNullDictionary_Unit_Contains_ValueIsNull()
        {
            IDictionary<String, String> dictionary = new Dictionary<String, String>() {
                { "Key1", "Value1" },
                { "Key2", "Value2" },
                { "Key3", "Value3" }
            };
            ICollection<KeyValuePair<String, String>> target = new NonNullDictionary<String, String>(dictionary);
            KeyValuePair<String, String> item = new KeyValuePair<String, String>(dictionary.Keys.First(), null);

            Boolean actual = target.Contains(item);
            Assert.AreEqual(false, actual);
        }
コード例 #2
0
        public void NonNullDictionary_Unit_Remove2_Optimal()
        {
            IDictionary<String, String> dictionary = new Dictionary<String, String>() {
                { "Key1", "Value1" },
                { "Key2", "Value2" },
                { "Key3", "Value3" }
            };
            ICollection<KeyValuePair<String, String>> target = new NonNullDictionary<String, String>(dictionary);
            String key = dictionary.Keys.First();
            String value = dictionary[dictionary.Keys.First()];
            KeyValuePair<String, String> item = new KeyValuePair<String, String>(key, value);

            Boolean actual = target.Remove(item);
            Assert.AreEqual(true, actual);
            Assert.IsFalse(target.Contains(item));
        }
コード例 #3
0
        public void NonNullDictionary_Unit_Add2_Optimal()
        {
            ICollection<KeyValuePair<String, String>> target = new NonNullDictionary<String, String>();
            String key = "MyKey";
            String value = "MyValue";
            KeyValuePair<String, String> item = new KeyValuePair<String, String>(key, value);

            target.Add(item);
            Assert.IsTrue(target.Contains(item));
        }