1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using ICSharpCode.Scripting;
6
using ICSharpCode.Scripting.Tests.Utils;
9
namespace ICSharpCode.Scripting.Tests.Console
12
public class SendLineToScriptingConsoleCommandTests : SendToScriptingConsoleCommandTestsBase
14
SendLineToScriptingConsoleCommand sendLineToConsoleCommand;
17
public void Run_SingleLineInTextEditor_FirstLineSentToPythonConsole()
19
CreateSendLineToConsoleCommand();
20
AddSingleLineToTextEditor("print 'hello'");
21
sendLineToConsoleCommand.Run();
23
string text = fakeConsole.TextPassedToSendLine;
25
string expectedText = "print 'hello'";
26
Assert.AreEqual(expectedText, text);
29
void CreateSendLineToConsoleCommand()
31
base.CreateFakeWorkbench();
32
sendLineToConsoleCommand = new SendLineToScriptingConsoleCommand(workbench);
35
void AddSingleLineToTextEditor(string line)
37
fakeTextEditor.Document.Text = line;
38
fakeTextEditor.Caret.Line = 1;
40
SetTextToReturnFromTextEditorGetLine(line);
43
void SetTextToReturnFromTextEditorGetLine(string line)
45
FakeDocumentLine documentLine = new FakeDocumentLine();
46
documentLine.Text = line;
47
fakeTextEditor.FakeDocument.DocumentLineToReturnFromGetLine = documentLine;
51
public void Run_TwoLinesInTextEditorCursorOnFirstLine_FirstLineSentToPythonConsole()
53
CreateSendLineToConsoleCommand();
55
fakeTextEditor.Document.Text =
59
fakeTextEditor.Caret.Line = 1;
61
SetTextToReturnFromTextEditorGetLine("print 'hello'");
63
sendLineToConsoleCommand.Run();
64
string text = fakeConsole.TextPassedToSendLine;
66
string expectedText = "print 'hello'";
67
Assert.AreEqual(expectedText, text);
71
public void Run_SingleLineInTextEditor_ScriptingConsolePadBroughtToFront()
73
CreateSendLineToConsoleCommand();
74
AddSingleLineToTextEditor("print 'hello'");
76
sendLineToConsoleCommand.Run();
78
bool broughtToFront = workbench.FakeScriptingConsolePad.BringToFrontCalled;
79
Assert.IsTrue(broughtToFront);