public void MoveOneCharacterIntoPromptTypingShouldBePrevented() { FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Left); FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A); Assert.AreEqual(String.Empty, TestableScriptingConsole.GetCurrentLine()); }
public void MoveOneCharacterIntoPromptAndBackspaceKeyShouldNotRemoveAnything() { FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A); FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Left); FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Back); Assert.AreEqual("A", TestableScriptingConsole.GetCurrentLine()); Assert.AreEqual(prompt + "A", FakeConsoleTextEditor.Text); }
public void LeftArrowThenInsertNewCharacterInsertsText() { FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A); FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.B); FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Left); FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.C); Assert.AreEqual("ACB", TestableScriptingConsole.GetCurrentLine()); }
public void CanBackspaceFirstCharacterOnLine() { FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A); FakeConsoleTextEditor.Column = 5; FakeConsoleTextEditor.SelectionStart = 5; FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Back); Assert.AreEqual(String.Empty, TestableScriptingConsole.GetCurrentLine()); }
public void SelectLastCharacterOfPromptThenPressingTheBackspaceKeyShouldNotRemoveAnything() { FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A); FakeConsoleTextEditor.SelectionStart = prompt.Length - 1; FakeConsoleTextEditor.SelectionLength = 2; FakeConsoleTextEditor.Column += 2; FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Back); Assert.AreEqual("A", TestableScriptingConsole.GetCurrentLine()); Assert.AreEqual(prompt + "A", FakeConsoleTextEditor.Text); }
public void BackspaceOnPreviousLine() { FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A); FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.B); FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Enter); TestableScriptingConsole.Write(prompt, ScriptingStyle.Prompt); FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.C); // Move up a line with cursor. FakeConsoleTextEditor.Line = 0; Assert.IsTrue(FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Back)); Assert.AreEqual("C", TestableScriptingConsole.GetCurrentLine()); }
public void CurrentLineIsEmpty() { Assert.AreEqual(String.Empty, console.GetCurrentLine()); }
public void TextAfterUpArrowKeyPressedTwiceThenDownArrowKey() { UpArrowKeyPressedTwiceThenDownArrowKey(); Assert.AreEqual("BC", TestableScriptingConsole.GetCurrentLine()); }
public void CurrentLineAfterUpArrowKeyPressed() { FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Up); Assert.AreEqual("BC", TestableScriptingConsole.GetCurrentLine()); }