public void TryGetValue_SomeElement_ReturnFalse() { CustomHashTable <string, int> hashTable = new CustomHashTable <string, int> { { "1", 1 }, { "2", 2 }, { "4", 3 }, { "5", 4 }, { "6", 5 }, { "13", 6 } }; var containsItem = hashTable.TryGetValue("3", out var value); Assert.IsFalse(containsItem); Assert.AreEqual(value, default(int)); }
public void TryGetValue_SomeElement_ReturnTrue() { CustomHashTable <string, string> hashTable = new CustomHashTable <string, string> { { "1", "One" }, { "2", "Two" }, { "4", "Four" }, { "5", "Five" }, { "6", "Six" }, { "13", "Three, No" } }; var containsItem = hashTable.TryGetValue("13", out var value); Assert.IsTrue(containsItem); Assert.AreEqual(value, "Three, No"); }