/// <inheritdoc /> public bool Remove(string key, string value) { if (value == null) { throw new ArgumentNullException("value"); } return(contents.Remove(key, value)); }
public void TestRemove() { IMultiMap <int, int> map = HashMultiMap <int, int> .Create(); map.Add(2, 3); map.Add(2, 4); map.Add(2, 5); map.Remove(2, 5); Assert.IsFalse(map.ContainsKeyValuePair(new System.Collections.Generic.KeyValuePair <int, int>(2, 5))); map.Remove(2, 4); Assert.IsFalse(map.ContainsKeyValuePair(new System.Collections.Generic.KeyValuePair <int, int>(2, 4))); map.Remove(2, 3); Assert.IsFalse(map.ContainsKeyValuePair(new System.Collections.Generic.KeyValuePair <int, int>(2, 3))); }
public virtual void TestListener() { var latch1Add = new CountdownEvent(8); var latch1Remove = new CountdownEvent(4); var latch2Add = new CountdownEvent(3); var latch2Remove = new CountdownEvent(3); var listener1 = new EntryAdapter <object, object>( delegate { latch1Add.Signal(); }, delegate { latch1Remove.Signal(); }, delegate { }, delegate { }); var listener2 = new EntryAdapter <object, object>( delegate { latch2Add.Signal(); }, delegate { latch2Remove.Signal(); }, delegate { }, delegate { }); mm.AddEntryListener(listener1, true); mm.AddEntryListener(listener2, "key3", true); mm.Put("key1", "value1"); mm.Put("key1", "value2"); mm.Put("key1", "value3"); mm.Put("key2", "value4"); mm.Put("key2", "value5"); mm.Remove("key1", "value2"); mm.Put("key3", "value6"); mm.Put("key3", "value7"); mm.Put("key3", "value8"); mm.Remove("key3"); Assert.IsTrue(latch1Add.Wait(TimeSpan.FromSeconds(20))); Assert.IsTrue(latch1Remove.Wait(TimeSpan.FromSeconds(20))); Assert.IsTrue(latch2Add.Wait(TimeSpan.FromSeconds(20))); Assert.IsTrue(latch2Remove.Wait(TimeSpan.FromSeconds(20))); }