-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ivanbasov/integration tests #17885
Ivanbasov/integration tests #17885
Changes from 8 commits
5e7aa67
06a6371
9ffd288
f7a5c53
1764c30
4f4aa7f
6383c45
103153b
7165eae
8994583
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.VisualStudio.IntegrationTest.Utilities; | ||
using Microsoft.VisualStudio.IntegrationTest.Utilities.Input; | ||
using Xunit; | ||
|
||
namespace Roslyn.VisualStudio.IntegrationTests.CSharp | ||
{ | ||
[Collection(nameof(SharedIntegrationHostFixture))] | ||
public class CSharpInteractiveCommands : AbstractInteractiveWindowTest | ||
{ | ||
public CSharpInteractiveCommands(VisualStudioInstanceFactory instanceFactory) | ||
: base(instanceFactory) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public void VerifyPreviousAndNextHistory() | ||
{ | ||
SubmitText("1 + 2"); | ||
SubmitText("1.ToString()"); | ||
SendKeys(new KeyPress(VirtualKey.Up, ShiftState.Alt)); | ||
VerifyLastReplInput("1.ToString()"); | ||
SendKeys(VirtualKey.Enter); | ||
WaitForReplOutput("\"1\""); | ||
SendKeys(new KeyPress(VirtualKey.Up, ShiftState.Alt)); | ||
VerifyLastReplInput("1.ToString()"); | ||
SendKeys(new KeyPress(VirtualKey.Up, ShiftState.Alt)); | ||
VerifyLastReplInput("1 + 2"); | ||
SendKeys(VirtualKey.Enter); | ||
WaitForReplOutput("3"); | ||
SendKeys(new KeyPress(VirtualKey.Down, ShiftState.Alt)); | ||
VerifyLastReplInput("1.ToString()"); | ||
SendKeys(VirtualKey.Enter); | ||
WaitForReplOutput("\"1\""); | ||
} | ||
|
||
[Fact] | ||
public void VerifyMaybeExecuteInput() | ||
{ | ||
InsertCode("2 + 3"); | ||
SendKeys(VirtualKey.Enter); | ||
WaitForReplOutput("5"); | ||
} | ||
|
||
[Fact] | ||
public void VerifyNewLineAndIndent() | ||
{ | ||
InsertCode("3 + "); | ||
SendKeys(VirtualKey.Enter); | ||
InsertCode("4"); | ||
SendKeys(VirtualKey.Enter); | ||
WaitForReplOutput("7"); | ||
} | ||
|
||
[Fact] | ||
public void VerifyExecuteInput() | ||
{ | ||
SubmitText("1 + "); | ||
VerifyLastReplOutputContains("CS1733"); | ||
} | ||
|
||
[Fact] | ||
public void VerifyForceNewLineAndIndent() | ||
{ | ||
InsertCode("1 + 2"); | ||
SendKeys(VirtualKey.Enter); | ||
SubmitText("+ 3"); | ||
VerifyReplPromptConsistency("<![CDATA[1 + 2 + 3]]>", "6"); | ||
} | ||
|
||
[Fact] | ||
public void VerifyCancelInput() | ||
{ | ||
InsertCode("1 + 4"); | ||
SendKeys(new KeyPress(VirtualKey.Enter, ShiftState.Shift)); | ||
SendKeys(VirtualKey.Escape); | ||
VerifyLastReplInput(string.Empty); | ||
} | ||
|
||
[Fact] | ||
public void VerifyUndoAndRedo() | ||
{ | ||
ClearReplText(); | ||
InsertCode(" 2 + 4 "); | ||
SendKeys(new KeyPress(VirtualKey.Z, ShiftState.Ctrl)); | ||
VerifyReplPromptConsistency("< ![CDATA[]] >", string.Empty); | ||
SendKeys(new KeyPress(VirtualKey.Y, ShiftState.Ctrl)); | ||
VerifyLastReplInput(" 2 + 4 "); | ||
SendKeys(VirtualKey.Enter); | ||
WaitForReplOutput("6"); | ||
} | ||
|
||
[Fact] | ||
public void CutDeletePasteSelectAll() | ||
{ | ||
SendKeys("Text"); | ||
ExecuteCommand("Edit.LineStart"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: It would be nice if we had these commands centralized somewhere for general use. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! Will update |
||
ExecuteCommand("Edit.LineEnd"); | ||
ExecuteCommand("Edit.LineStartExtend"); | ||
ExecuteCommand("Edit.SelectionCancel"); | ||
ExecuteCommand("Edit.LineEndExtend"); | ||
ExecuteCommand("Edit.SelectAll"); | ||
ExecuteCommand("Edit.SelectAll"); | ||
ExecuteCommand("Edit.Copy"); | ||
ExecuteCommand("Edit.Cut"); | ||
ExecuteCommand("Edit.Paste"); | ||
ExecuteCommand("Edit.Delete"); | ||
ExecuteCommand("Edit.LineUp"); | ||
ExecuteCommand("Edit.LineDown"); | ||
ExecuteCommand("Edit.Paste"); | ||
ExecuteCommand("Edit.Paste"); | ||
SendKeys(VirtualKey.Escape); | ||
} | ||
|
||
//<!-- Regression test for bug 13731. | ||
// Unfortunately we don't have good unit-test infrastructure to test InteractiveWindow.cs. | ||
// For now, since we don't have coverage of InteractiveWindow.IndentCurrentLine at all, | ||
// I'd rather have a quick integration test scenario rather than no coverage at all. | ||
// At some point when we start investing in Interactive work again, we'll go through some | ||
// of these tests and convert them to unit-tests. | ||
// --> | ||
//<!-- TODO(https://github.com/dotnet/roslyn/issues/4235) | ||
[Fact] | ||
public void VerifyReturnIndentCurrentLine() | ||
{ | ||
InteractiveWindow.ClearScreen(); | ||
SendKeys(" ("); | ||
SendKeys(")"); | ||
SendKeys(VirtualKey.Left); | ||
SendKeys(VirtualKey.Enter); | ||
VerifyCaretPosition(12); | ||
} | ||
} | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: AbstractEditorTest provides a function for doing
Ctrl(VirtualKey.Z)
: http://source.roslyn.io/#Roslyn.VisualStudio.IntegrationTests/AbstractEditorTest.cs,144, it would be nice if we could be consistent across the various tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Will update