public void LeftArrowThenInsertNewCharacterInsertsText()
		{
			textEditor.RaiseKeyPressEvent('a');
			textEditor.RaiseKeyPressEvent('b');
			textEditor.RaiseDialogKeyPressEvent(Keys.Left);
			textEditor.RaiseKeyPressEvent('c');
			
			Assert.AreEqual("acb", console.GetCurrentLine());
		}
Exemplo n.º 2
0
        public void EnterKeyDoesNotBreakUpExistingLine()
        {
            textEditor.RaiseKeyPressEvent('a');
            textEditor.RaiseKeyPressEvent('b');
            textEditor.SelectionStart = 1 + prompt.Length;
            textEditor.Column         = 1 + prompt.Length;
            textEditor.RaiseDialogKeyPressEvent(Keys.Enter);

            Assert.AreEqual(">>> ab\r\n", textEditor.Text);
        }
        public void Init()
        {
            textEditor  = new MockTextEditor();
            RubyConsole = new RubyConsole(textEditor, null);
            RubyConsole.Write(prompt, Style.Prompt);

            textEditor.RaiseKeyPressEvent('a');
            textEditor.RaiseDialogKeyPressEvent(Keys.Enter);
            RubyConsole.Write(prompt, Style.Prompt);
            textEditor.RaiseKeyPressEvent('b');
            textEditor.RaiseKeyPressEvent('.');
        }
Exemplo n.º 4
0
        public void Init()
        {
            mockTextEditor = new MockTextEditor();
            RubyConsole    = new RubyConsole(mockTextEditor, null);

            autoIndentSize = initialAutoIndentSize;
            Thread thread = new Thread(ReadLineFromConsoleOnDifferentThread);

            thread.Start();

            int sleepInterval = 10;
            int maxWait       = 2000;
            int currentWait   = 0;

            while (mockTextEditor.Text.Length < autoIndentSize && currentWait < maxWait)
            {
                Thread.Sleep(sleepInterval);
                currentWait += sleepInterval;
            }

            raiseKeyPressEvent       = mockTextEditor.RaiseKeyPressEvent('a');
            raiseDialogKeyPressEvent = mockTextEditor.RaiseDialogKeyPressEvent(Keys.Enter);

            currentWait = 0;
            while ((mockTextEditor.Text.Length < autoIndentSize + 2) && (currentWait < maxWait))
            {
                Thread.Sleep(10);
                currentWait += sleepInterval;
            }
            thread.Join(2000);
        }
        public void HomeKeyPressedWhenTextInConsole()
        {
            textEditor.RaiseKeyPressEvent('a');
            textEditor.RaiseDialogKeyPressEvent(Keys.Home);

            int expectedColumn = prompt.Length;

            Assert.AreEqual(expectedColumn, textEditor.Column);
        }
        public void SetUpFixture()
        {
            textEditor = new MockTextEditor();
            console    = new RubyConsole(textEditor, null);
            console.WriteLine(prompt, Style.Prompt);

            textEditor.RaiseKeyPressEvents("a");
            showCompletionWindowCalledBeforeDotTypedIn = textEditor.IsShowCompletionWindowCalled;
            textEditor.RaiseKeyPressEvent('.');
        }
        public void AddOneLine()
        {
            textEditor.RaiseKeyPressEvent('a');
            textEditor.RaiseDialogKeyPressEvent(Keys.Enter);

            string[] expectedLines = new string[] { "a" };

            Assert.AreEqual(expectedLines, RubyConsole.GetUnreadLines());
            Assert.IsTrue(RubyConsole.IsLineAvailable);
        }
Exemplo n.º 8
0
        public void NoTextWrittenWhenAutoIndentSizeIsZero()
        {
            MockTextEditor textEditor = new MockTextEditor();
            RubyConsole    console    = new RubyConsole(textEditor, null);

            textEditor.RaiseKeyPressEvent('a');
            textEditor.RaiseDialogKeyPressEvent(Keys.Enter);

            textEditor.IsWriteCalled = false;
            console.ReadLine(0);
            Assert.IsFalse(textEditor.IsWriteCalled);
        }
        public void SetUpFixture()
        {
            MockTextEditor textEditor = new MockTextEditor();

            using (RubyConsole = new RubyConsole(textEditor, null)) {
                textEditor.RaiseKeyPressEvent('a');
                textEditor.RaiseKeyPressEvent('=');
                textEditor.RaiseKeyPressEvent('1');
                lineAvailableBeforeFirstEnterKey = RubyConsole.IsLineAvailable;
                textEditor.RaiseDialogKeyPressEvent(Keys.Enter);
                lineAvailableAfterFirstEnterKey = RubyConsole.IsLineAvailable;

                textEditor.RaiseKeyPressEvent('b');
                textEditor.RaiseKeyPressEvent('=');
                textEditor.RaiseKeyPressEvent('2');
                textEditor.RaiseDialogKeyPressEvent(Keys.Enter);

                Thread t = new Thread(ReadLinesOnSeparateThread);
                t.Start();

                int sleepInterval = 20;
                int currentWait   = 0;
                int maxWait       = 2000;

                while (line2 == null && currentWait < maxWait)
                {
                    Thread.Sleep(sleepInterval);
                    currentWait += sleepInterval;
                }

                lineAvailableAtEnd = RubyConsole.IsLineAvailable;
            }
        }
Exemplo n.º 10
0
 public void SingleCharacterAddedToTextEditor()
 {
     textEditor.RaiseKeyPressEvent('a');
     Assert.AreEqual("a", RubyConsole.GetCurrentLine());
 }