public void TryGetValueTest() { IWDT iwdt = new IWDT(); int value; Assert.IsFalse(iwdt.TryGetValue(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.TryGetValue(HT(1, 2), out value)); Assert.AreEqual(2, value); Assert.IsTrue(iwdt.TryGetValue(HT(2, 2), out value)); Assert.AreEqual(3, value); Assert.IsTrue(iwdt.TryGetValue(HT(3, 2), out value)); Assert.AreEqual(4, value); iwdt.Keys[Tuple.Create(1, 1)].IsGarbage = true; Assert.IsFalse(iwdt.TryGetValue(HT(1, 2), out value)); }