public static void displayHashes() { Hashtables hashTables = new Hashtables(); hashTables.Add("abc", "Josie"); hashTables.Add("Dog", "Woof"); hashTables.Add("333", "ponies"); hashTables.Add("moons", "44"); hashTables.Add("cba", "Doctor"); //Collision abc same as cba Console.WriteLine($"Should return as 'True' for contains: {hashTables.Contains("moons")}"); Console.WriteLine($"Should return as 'False' for contains: {hashTables.Contains("planet")}"); Console.WriteLine($"Should return the value 'Woof' from key: {hashTables.GetValue("Dog")}"); Console.WriteLine($"Should return the value 'Doctor' from collision: {hashTables.GetValue("cba")}"); }
public void GetValue(string key, object value) { Hashtables hashTables = new Hashtables(); hashTables.Add(key, value); Assert.Equal(value, hashTables.GetValue(key)); }
public void GetCollision1() { Hashtables hashTables = new Hashtables(); hashTables.Add("abc", "Josie"); hashTables.Add("cba", 22); hashTables.Add("acb", true); Assert.Equal("Josie", hashTables.GetValue("abc")); }
public void GetNull3() { Hashtables hashTables = new Hashtables(); hashTables.Add("abc", "Josie"); hashTables.Add("Dog", "Woof"); hashTables.Add("333", "ponies"); hashTables.Add("moons", "44"); Assert.Null(hashTables.GetValue("three")); }