public void TryGetByValueTest() { var bi = new BiDirectionalDictionary <int, int> { { 1, 10 }, { 2, 20 }, { 3, 30 } }; Assert.IsTrue(bi.TryGetByValue(10, out var key)); Assert.AreEqual(1, key); Assert.IsFalse(bi.TryGetByValue(100, out _)); }
public void BiDirectionalDictionaryTryGetByValue() { var bi = new BiDirectionalDictionary <int, int> { { 1, 1 }, { 2, 12 } }; Assert.AreEqual(2, bi.Count); var found = bi.TryGetByValue(12, out var key); Assert.IsTrue(found); Assert.AreEqual(2, key); }