public void EndToEndWithInMainProject() { var FakeGuiConsoleWindow = new TextHandOffAggregator(); ROT13EncodingFileWriter.Do(FakeGuiConsoleWindow, "e2e_from.txt", "e2e_to.txt"); Assert.That(File.Exists("topath/e2e_to.txt"), "It should have created a results file."); Assert.That(File.ReadAllText("topath/e2e_to.txt"), Is.EqualTo(FromLinesToText(CorrectText))); Assert.That(FakeGuiConsoleWindow.ReceivedText, Is.EqualTo(CorrectText)); }
public void When_reading_a_whole_multi_line_file_at_once() { var textObserver = new TextHandOffAggregator(); var reader = new OneLineAtATimeFileReader(); reader.OnNewTextAvailableNotify(textObserver); reader.SetWorkingDirectory(TEST_FILE_PATH); reader.SetFilePath("multilineFile.txt"); reader.Read(); Assert.That(textObserver.ReceivedText, Is.EqualTo(new []{"a", "b"})); }
public void When_reading_a_whole_empty_file_at_once() { var fileLineCount = 0; var textObserver = new TextHandOffAggregator(); var reader = new OneLineAtATimeFileReader(); reader.OnNewTextAvailableNotify(textObserver); reader.SetWorkingDirectory(TEST_FILE_PATH); reader.SetFilePath("emptyTestFile.txt"); reader.Read(); Assert.That(textObserver.ReceivedText.Count, Is.EqualTo(fileLineCount), "The result should contain all of the text in the file."); }