Example #1
0
        public void MoveOneCharacterIntoPromptTypingShouldBePrevented()
        {
            FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Left);
            FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A);

            Assert.AreEqual(String.Empty, TestableScriptingConsole.GetCurrentLine());
        }
Example #2
0
        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);
        }
Example #3
0
        public void LeftArrowThenInsertNewCharacterInsertsText()
        {
            FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A);
            FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.B);
            FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Left);
            FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.C);

            Assert.AreEqual("ACB", TestableScriptingConsole.GetCurrentLine());
        }
Example #4
0
        public void CanBackspaceFirstCharacterOnLine()
        {
            FakeConsoleTextEditor.RaisePreviewKeyDownEvent(Key.A);
            FakeConsoleTextEditor.Column         = 5;
            FakeConsoleTextEditor.SelectionStart = 5;
            FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Back);

            Assert.AreEqual(String.Empty, TestableScriptingConsole.GetCurrentLine());
        }
Example #5
0
        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);
        }
Example #6
0
        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());
 }
Example #8
0
 public void TextAfterUpArrowKeyPressedTwiceThenDownArrowKey()
 {
     UpArrowKeyPressedTwiceThenDownArrowKey();
     Assert.AreEqual("BC", TestableScriptingConsole.GetCurrentLine());
 }
Example #9
0
 public void CurrentLineAfterUpArrowKeyPressed()
 {
     FakeConsoleTextEditor.RaisePreviewKeyDownEventForDialogKey(Key.Up);
     Assert.AreEqual("BC", TestableScriptingConsole.GetCurrentLine());
 }