public void GivenWordArrayWithNoDuplicates_WhenGetWordOccurences_ThenReturnsDictionaryOfCountedWords( string[] wordArray, WordOccurrenceService service ) { // ARRANGE // ACT var results = service.GetWordOccurences(wordArray); // ASSERT results.Should().NotBeEmpty().And.NotBeNull(); results.TryGetValue(wordArray[0], out int value); value.Should().Be(1); }
public void GivenWordArrayWithDuplicates_WhenGetWordOccurences_ThenReturnsDictionaryOfCountedWords( string word, WordOccurrenceService service ) { // ARRANGE var wordArray = new string[] { word, word, word, "something" }; // ACT var results = service.GetWordOccurences(wordArray); // ASSERT results.Should().NotBeEmpty().And.NotBeNull(); results.TryGetValue(word, out int value); value.Should().Be(3); results.TryGetValue("something", out int singleValue); singleValue.Should().Be(1); }