public void NonNullDictionary_Unit_Remove2_ValueDoesNotExist() { 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 = "MyValue"; KeyValuePair<String, String> item = new KeyValuePair<String, String>(key, value); Boolean actual = target.Remove(item); Assert.AreEqual(false, actual); }
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)); }
public void NonNullDictionary_Unit_Remove1_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.Remove(key); }
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)); }
public void NonNullDictionary_Unit_Remove1_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.Remove(key); Assert.AreEqual(false, actual); }