public virtual void Remove_True() { #region data var idx = new BinaryTreeIndex(); var key_1 = 1L; var val_1 = 1L; #endregion #region test idx.Add(key_1, val_1); Assert.AreEqual(1L, idx.KeyCount()); Assert.AreEqual(1L, idx.ValueCount()); // remove the key Assert.IsTrue(idx.Remove(key_1)); // and check the counters Assert.AreEqual(0L, idx.KeyCount()); Assert.AreEqual(0L, idx.ValueCount()); #endregion }
public virtual void Remove_False() { #region data var idx = new BinaryTreeIndex(); var key_1 = 1L; var key_2 = 2L; var key_3 = 3L; var val_1 = 1L; var val_2 = 2L; #endregion #region test idx.Add(key_1, val_1); idx.Add(key_2, val_2); Assert.AreEqual(2L, idx.KeyCount()); Assert.AreEqual(2L, idx.ValueCount()); // remove the not existing key 3 Assert.IsFalse(idx.Remove(key_3)); // and check the counters Assert.AreEqual(2L, idx.KeyCount()); Assert.AreEqual(2L, idx.ValueCount()); // remove existing key 1 Assert.IsTrue(idx.Remove(key_1)); // and check the counters Assert.AreEqual(1L, idx.KeyCount()); Assert.AreEqual(1L, idx.ValueCount()); // remove not existing key 1 Assert.IsFalse(idx.Remove(key_1)); // and check the counters Assert.AreEqual(1L, idx.KeyCount()); Assert.AreEqual(1L, idx.ValueCount()); #endregion }