public void RemoveKey() { _hashCounter["abc"] = 8; _hashCounter["def"] = 150; _hashCounter["ghi"] = 25; _hashCounter.Remove("abc"); _hashCounter["def"] = 0; _hashCounter.Subtract("ghi", 25); using (IEnumerator <KeyValuePair <string, int> > enumerator = _hashCounter.GetEnumerator()) { while (enumerator.MoveNext()) { switch (enumerator.Current.Key) { case "abc": case "def": case "ghi": Assert.Fail("Removed key present in enumerator."); break; } } } }
public void DoesNotHaveRemovedKeys() { _hashCounter["abc"] = 8; _hashCounter["def"] = 150; _hashCounter["ghi"] = 25; _hashCounter.Remove("abc"); _hashCounter["def"] = 0; _hashCounter.Subtract("ghi", 25); ICollection <string> keys = _hashCounter.Keys; Assert.Zero(keys.Count); }
public void RemovedKey_False() { _hashCounter["abc"] = 8; _hashCounter["def"] = 150; _hashCounter["ghi"] = 25; _hashCounter.Remove("abc"); _hashCounter["def"] = 0; _hashCounter.Subtract("ghi", 25); Assert.False(_hashCounter.Contains("abc")); Assert.False(_hashCounter.Contains("def")); Assert.False(_hashCounter.Contains("ghi")); }