public void SendLine_NoUnreadLines_NoTextWrittenToConsoleTextEditorBeforeFirstPromptIsWritten() { base.CreateConsole(); TestableScriptingConsole.SendLine("test"); string text = FakeConsoleTextEditor.TextPassedToWrite; Assert.IsNull(text); }
public void Write_SendLineCalledButNoPromptWritten_WritesOutSavedSendLineText() { base.CreateConsole(); TestableScriptingConsole.SendLine("test"); TestableScriptingConsole.Write(">>> ", ScriptingStyle.Prompt); string text = FakeConsoleTextEditor.Text; string expectedText = ">>> test\r\n"; Assert.AreEqual(expectedText, text); }
public void SendLine_TwoLinesInConsoleTextEditorCursorOnFirstLine_CursorMovedToEndOfLastLineBeforeTextWritten() { base.CreateConsole(); WritePrompt(); FakeConsoleTextEditor.Text = ">>> first\r\n" + ">>> second\r\n" + ">>> "; FakeConsoleTextEditor.Line = 0; FakeConsoleTextEditor.Column = 0; TestableScriptingConsole.SendLine("test"); int expectedLine = 2; int expectedColumn = 4; Location expectedLocation = new Location(expectedColumn, expectedLine); Location location = FakeConsoleTextEditor.CursorLocationWhenWriteTextCalled; Assert.AreEqual(expectedLocation, location); }
void SendLineToConsole(string text) { base.CreateConsole(); WritePrompt(); TestableScriptingConsole.SendLine(text); }