// test if the program can return the number of times a word appears in a string public void FindWord_CountInstances_Count() { // Arrange string newLongString = "This is a string"; string newTargetWord = "string"; RepeatCounter newRepeatCounter = new RepeatCounter(newLongString); newRepeatCounter.SetTargetWord(newTargetWord); newRepeatCounter.StringSplitter(); // Act newRepeatCounter.FindWord(); // Assert Assert.Equal(1, newRepeatCounter.GetWordCount()); }
// test if the program can find the target word in a large number of words public void FindWord_AllCheck_Bool() { // Arrange string newLongString = "This is a string"; string newTargetWord = "string"; RepeatCounter newRepeatCounter = new RepeatCounter(newLongString); newRepeatCounter.SetTargetWord(newTargetWord); newRepeatCounter.StringSplitter(); // Act bool testResult = newRepeatCounter.FindWord(); // Assert Assert.Equal(true, testResult); }