private static string[] ReadFile(string filepath) { WriteLine($"Reading from file. Please wait ...."); WriteLine(); using (var fileStream = new FileStream(filepath, FileMode.Open)) { var cleaner = new LineCleaner(); var list = new StreamWordListGenerator(fileStream, cleaner); var words = list.Generate(); return(words); } }
public void Split_line_up_into_normalized_list_of_words() { const string text = "The rustle of a woman’s dress was heard in the next room."; var expected = new [] { "The", "rustle", "of", "a", "woman’s", "dress", "was", "heard", "in", "the", "next", "room" }; string[] actual; using (var stream = GetStream(text)) { var generator = new StreamWordListGenerator(stream, new LineCleaner()); actual = generator.Generate(); } Assert.That(actual, Is.EqualTo(expected)); }