public void CounterServiceReturnsCountedWords(string sentence, ObservableCollection<WordCountViewModel> expectedResult) { var searcher = new WordsCounterService(); var countedWords = new ObservableCollection<WordCountViewModel>(); searcher.Count(sentence, countedWords); Assert.That(countedWords.Count, Is.EqualTo(expectedResult.Count)); Assert.IsTrue(expectedResult.All(x => Contains(countedWords, x))); }
public void EmptySearchReturnsNoResult() { const string sentence = ""; var counter = new WordsCounterService(); var countedWords = new ObservableCollection<WordCountViewModel>(); counter.Count(sentence, countedWords); Assert.IsEmpty(countedWords); }
public void SentencesSplitOnSpecialCharacters(string specialCharacter) { var sentence = string.Format("firstPart{0}secondPart", specialCharacter); var counter = new WordsCounterService(); var countedWords = new ObservableCollection<WordCountViewModel>(); var wordCountViewModels = new ObservableCollection<WordCountViewModel> { new WordCountViewModel { Word = "firstPart", Count = 1 }, new WordCountViewModel { Word = "secondPart", Count = 1 } }; counter.Count(sentence, countedWords); Assert.That(countedWords.All(x => Contains(wordCountViewModels, x))); }