Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        public void TestRemoveException()
        {
            var m = new SlotMap <object>();

            m.Remove(0);
        }