public void TestReuseKey() { var m = new SlotMap <object>(); var obj = new object(); var key1 = m.Add(obj); m.Remove(key1); var key2 = m.Add(obj); var ok = m.TryGet(key1, out object result); Assert.IsFalse(ok); Assert.IsNull(result); ok = m.TryGet(key2, out result); Assert.IsTrue(ok); Assert.AreEqual(obj, result); }
public void TestGet() { var m = new SlotMap <object>(); var obj = new object(); var key = m.Add(obj); Assert.AreEqual(obj, m.Get(key)); m.TryGet(key, out object result); Assert.AreEqual(obj, result); }
public void TestRemove() { var m = new SlotMap <object>(); var obj = new object(); var key = m.Add(obj); m.Remove(key); var ok = m.TryGet(key, out object result); Assert.IsFalse(ok); Assert.IsNull(result); }