public void TryAddTest() { var bi = new BiDirectionalDictionary <int, int> { { 1, 10 }, { 2, 20 }, { 3, 30 } }; Assert.IsTrue(bi.TryAdd(100, 1000)); Assert.IsFalse(bi.TryAdd(1, 15)); }
public void BiDirectionalDictionaryTryAdd() { var bi = new BiDirectionalDictionary <int, int> { { 1, 1 }, { 2, 2 } }; Assert.AreEqual(2, bi.Count); Assert.IsTrue(bi.TryAdd(3, 3)); Assert.AreEqual(3, bi.Count); Assert.IsFalse(bi.TryAdd(1, 2)); Assert.AreEqual(3, bi.Count); }