public void TryRemoveTest() { IWDT iwdt = new IWDT(); var asDictionary = (IDictionary <Tuple <int, int>, int>)iwdt; int value; Assert.IsFalse(iwdt.TryRemove(HT(1, 2), out value)); iwdt.AddOrUpdate(HT(1, 1), 2, (k, v) => { throw new AssertFailedException(); return(default(int)); }); iwdt.AddOrUpdate(HT(2, 1), 3, (k, v) => { throw new AssertFailedException(); return(default(int)); }); iwdt.AddOrUpdate(HT(3, 1), 4, (k, v) => { throw new AssertFailedException(); return(default(int)); }); Assert.IsTrue(iwdt.TryRemove(HT(1, 2), out value)); Assert.AreEqual(2, value); Assert.IsFalse(asDictionary.ContainsKey(Tuple.Create(1, 2))); iwdt.Keys[Tuple.Create(2, 1)].IsGarbage = true; Assert.IsFalse(iwdt.TryRemove(HT(2, 2), out value)); }