public void To_String_Test() { //arrange MyCountingHashTable testHt = new MyCountingHashTable(1024); testHt.Add("Diana", 1); testHt.Add("Diana", 1); testHt.Add("Jazz", 1); //act string actual = testHt.ToString(); //assert Assert.Equal("Jazz : 1,Diana : 2,", actual); }
public static string[] CountsOfEachWord(string input) { MyCountingHashTable wordCounts = new MyCountingHashTable(1024); var words = input.Split(' '); foreach (var word in words) { wordCounts.Add(word.ToLower(), 1); } string wordCountsString = wordCounts.ToString(); string[] result = wordCountsString.Split(","); return(result); }
public void Counting_Repeats_Test() { //arrange MyCountingHashTable testHt = new MyCountingHashTable(1024); testHt.Add("Diana", 1); testHt.Add("Diana", 1); testHt.Add("Diana", 1); //act int actual = testHt.Get("Diana"); //assert Assert.Equal(3, actual); }