public void SendText_FirstPromptNotYetWrittenToConsole_NoTextWrittenToConsoleTextEditor() { base.CreateConsole(); TestableScriptingConsole.SendText("test"); string text = FakeConsoleTextEditor.TextPassedToAppend; Assert.IsNull(text); }
public void Write_SendTextCalledButNoPromptWritten_WritesOutSavedText() { base.CreateConsole(); TestableScriptingConsole.SendText("test"); TestableScriptingConsole.Write(">>> ", ScriptingStyle.Prompt); string text = FakeConsoleTextEditor.TextPassedToAppend; string expectedText = "test"; Assert.AreEqual(expectedText, text); }
public void Write_SendTextCalledWithTwoLinesButNoPromptWrittenAndWriteCalledTwice_WritesOutSecondLineOfSavedText() { base.CreateConsole(); string text = "first\r\n" + "second"; TestableScriptingConsole.SendText(text); TestableScriptingConsole.Write(">>> ", ScriptingStyle.Prompt); TestableScriptingConsole.Write(">>> ", ScriptingStyle.Prompt); string textPassedToWrite = FakeConsoleTextEditor.TextPassedToAppend; string expectedText = "second"; Assert.AreEqual(expectedText, textPassedToWrite); }
public void SendText_TextEditorHasTextAfterPrompt_CursorMovedToEndOfLastLineBeforeTextWritten() { base.CreateConsole(); WritePrompt(); FakeConsoleTextEditor.Text = ">>> first"; FakeConsoleTextEditor.Line = -1; FakeConsoleTextEditor.Column = -1; TestableScriptingConsole.SendText("test"); int expectedLine = 0; int expectedColumn = 9; Location expectedLocation = new Location(expectedColumn, expectedLine); Location location = FakeConsoleTextEditor.CursorLocationWhenWriteTextCalled; Assert.AreEqual(expectedLocation, location); }
void SendTextToConsole(string text) { base.CreateConsole(); WritePrompt(); TestableScriptingConsole.SendText(text); }