public void WordsFromString_ValidStringLine_ReturnsCorrectWordList() { string line = "This is my test file which contains some text." + "this checks if it's a word or a number(1234) or just punctuation('\"\\/!?-)." + "Seventy-five is one word. don't is one." + "\"Emmerich\", \"Emmerich's\", \"Emmerichs\" are different."; List <string> expectedWords = new List <string>() { "This", "is", "my", "test", "file", "which", "contains", "some", "text", "this", "checks", "if", "it's", "a", "word", "or", "a", "number", "or", "just", "punctuation", "Seventy-five", "is", "one", "word", "don't", "is", "one", "Emmerich", "Emmerich's", "Emmerichs", "are", "different" }; List <string> actualWords = FileWordCounter.WordsFromString(line).ToList(); Assert.AreEqual(expectedWords, actualWords); }
public void WordsFromString_EmptyString_ReturnsEmptyWordList() { Assert.AreEqual(new List <string>(), FileWordCounter.WordsFromString(string.Empty)); }
public void WordsFromString_StringWithNoValidWords_ReturnsEmptyWordList() { Assert.AreEqual(new List <string>(), FileWordCounter.WordsFromString("123456 --- !'\\\"/?><")); }
public void WordsFromString_Null_ThrowArgumentNullException() { Assert.Throws <ArgumentNullException>(() => FileWordCounter.WordsFromString(null)); }