示例#1
0
        public void NonNullDictionary_Unit_ContainsKey_KeyIsNull()
        {
            IDictionary<String, String> dictionary = new Dictionary<String, String>() {
                { "Key1", "Value1" },
                { "Key2", "Value2" },
                { "Key3", "Value3" }
            };
            NonNullDictionary<String, String> target = new NonNullDictionary<String, String>(dictionary);
            String key = null;

            target.ContainsKey(key);
        }
示例#2
0
        public void NonNullDictionary_Unit_Remove1_Optimal()
        {
            IDictionary<String, String> dictionary = new Dictionary<String, String>() {
                { "Key1", "Value1" },
                { "Key2", "Value2" },
                { "Key3", "Value3" }
            };
            NonNullDictionary<String, String> target = new NonNullDictionary<String, String>(dictionary);
            String key = dictionary.Keys.First();

            Boolean actual = target.Remove(key);
            Assert.AreEqual(true, actual);
            Assert.IsFalse(target.ContainsKey(key));
        }
示例#3
0
        public void NonNullDictionary_Unit_ContainsKey_KeyDoesNotExist()
        {
            IDictionary<String, String> dictionary = new Dictionary<String, String>() {
                { "Key1", "Value1" },
                { "Key2", "Value2" },
                { "Key3", "Value3" }
            };
            NonNullDictionary<String, String> target = new NonNullDictionary<String, String>(dictionary);
            String key = "MyKey";

            Boolean actual = target.ContainsKey(key);
            Assert.AreEqual(false, actual);
        }