public void TwoSameWords_ShouldReturnTwoOccurences() { var wordsCounter = new WordsCounter(CreateWordsLoaderStub(val => "word word")); var words = wordsCounter.Count(); Assert.Equal(2, words["word"]); }
public void TwoSameWords_ShouldReturnCount1() { var wordsCounter = new WordsCounter(CreateWordsLoaderStub(val => "one one")); var words = wordsCounter.Count(); Assert.Equal(1, words.Count); }
public void WordsWithPunctuation_ShouldNotTakePunctuationsIntoAccount() { var wordsCounter = new WordsCounter(CreateWordsLoaderStub(val => "a word, word a, (word.")); var words = wordsCounter.Count(); Assert.Equal(3, words["word"]); }
public void EmptyArray_ShouldReturnZeroWords() { var wordsCounter = new WordsCounter(CreateWordsLoaderStub(val => "")); var words = wordsCounter.Count(); Assert.Equal(0, words.Count); }
public void DifferentWords_ShouldReturnOccurences() { var wordsCounter = new WordsCounter(CreateWordsLoaderStub(val => "word test word word test")); var words = wordsCounter.Count(); Assert.Equal(3, words["word"]); Assert.Equal(2, words["test"]); }
public void BlankSpaces_ShouldBe_Ignored() { var wordsCounter = new WordsCounter(CreateWordsLoaderStub(val => "a b a ")); var words = wordsCounter.Count(); Assert.Equal(2, words.Count); }
public void TestWordcountWithoutStopwords() { WordsCounter wordCounter = new WordsCounter(new string[0]); int result = wordCounter.Count(new[] { "a", "bc", "def" }); Assert.AreEqual(3, result); }
public void TestWordcountWithStopwordsNotFound() { WordsCounter wordCounter = new WordsCounter(new[] { "xy" }); int result = wordCounter.Count(new[] { "a", "bc", "def" }); Assert.AreEqual(3, result); }
private static void RunPart1() { string fileLocation = GetFileLocation("part1fileinput.txt"); var fileLoader = new FileWordsLoader(fileLocation); var wordsCounter = new WordsCounter(fileLoader); try { PrintPart1(wordsCounter.Count()); } catch (FileNotFoundException) { Console.WriteLine("File was not found at location: {0}", fileLocation); } }
public void Words_ShouldSortOccurences() { var wordsCounter = new WordsCounter(CreateWordsLoaderStub(val => "word test word word test apple")); var words = wordsCounter.Count(); Assert.Equal("apple", words.Keys.ElementAt(0)); Assert.Equal("test", words.Keys.ElementAt(1)); Assert.Equal("word", words.Keys.ElementAt(2)); }