public static void Main() { RepeatCounters MyCounter = new RepeatCounters(); Console.WriteLine("I can take a word and a sentence and see how many times that word is contained in a sentence. Please enter the Word you want counted"); string Word = Console.ReadLine(); Console.WriteLine("Now please enter your sentence"); string Sentence = Console.ReadLine(); MyCounter.DoesItContain(Word, Sentence); Console.WriteLine($"You entered {Word}, {MyCounter.GrandTotal} Times"); }
public void DoesItContain_ChecksIfWordIsContained_WordIsThereUpdated() { // Arrange string Word = "cat"; string Sentence = "My cat lives in Petcat village with other cats that look like cat"; // Act RepeatCounters MyRepeatCounter = new RepeatCounters(); MyRepeatCounter.DoesItContain(Word, Sentence); // Assert Assert.AreEqual(1, MyRepeatCounter.WordIsThere); }
public void DoesItContain_ChecksIfWordIsContained_ExpectingZero() { // Arrange string Word = "cat"; string Sentence = "It is a dog sentence and reverse of tac is not here"; // Act RepeatCounters MyRepeatCounter = new RepeatCounters(); MyRepeatCounter.DoesItContain(Word, Sentence); // Assert Assert.AreEqual(0, MyRepeatCounter.WordIsThere); }