public void GetContentsTest() { IWDT iwdt = new IWDT(); var contents = iwdt.GetContents(); Assert.AreEqual(0, contents.Count); iwdt.AddOrUpdate(HT(1, 1), Tuple.Create(2, 1), (k, v) => { throw new AssertFailedException(); return(default(Tuple <int, int>)); }); iwdt.AddOrUpdate(HT(2, 1), Tuple.Create(3, 1), (k, v) => { throw new AssertFailedException(); return(default(Tuple <int, int>)); }); iwdt.AddOrUpdate(HT(3, 1), Tuple.Create(4, 1), (k, v) => { throw new AssertFailedException(); return(default(Tuple <int, int>)); }); contents = iwdt.GetContents(); Assert.AreEqual(3, contents.Count); Assert.IsTrue(contents.Contains(new KeyValuePair <Tuple <int, int>, Tuple <int, int> >(Tuple.Create(1, 1), Tuple.Create(2, 1)))); Assert.IsTrue(contents.Contains(new KeyValuePair <Tuple <int, int>, Tuple <int, int> >(Tuple.Create(2, 1), Tuple.Create(3, 1)))); Assert.IsTrue(contents.Contains(new KeyValuePair <Tuple <int, int>, Tuple <int, int> >(Tuple.Create(3, 1), Tuple.Create(4, 1)))); iwdt.Keys[Tuple.Create(1, 1)].IsGarbage = true; iwdt.Values[Tuple.Create(4, 1)].IsGarbage = true; contents = iwdt.GetContents(); Assert.AreEqual(1, contents.Count); Assert.IsTrue(contents.Contains(new KeyValuePair <Tuple <int, int>, Tuple <int, int> >(Tuple.Create(2, 1), Tuple.Create(3, 1)))); }