-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ivanbasov/integration tests (#17885)
Integration tests for CSharpInteractiveCommands
- Loading branch information
Showing
9 changed files
with
228 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveCommands.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(Alt(VirtualKey.Up)); | ||
VerifyLastReplInput("1.ToString()"); | ||
SendKeys(VirtualKey.Enter); | ||
WaitForReplOutput("\"1\""); | ||
SendKeys(Alt(VirtualKey.Up)); | ||
VerifyLastReplInput("1.ToString()"); | ||
SendKeys(Alt(VirtualKey.Up)); | ||
VerifyLastReplInput("1 + 2"); | ||
SendKeys(VirtualKey.Enter); | ||
WaitForReplOutput("3"); | ||
SendKeys(Alt(VirtualKey.Down)); | ||
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(Shift(VirtualKey.Enter)); | ||
SendKeys(VirtualKey.Escape); | ||
VerifyLastReplInput(string.Empty); | ||
} | ||
|
||
[Fact] | ||
public void VerifyUndoAndRedo() | ||
{ | ||
ClearReplText(); | ||
InsertCode(" 2 + 4 "); | ||
SendKeys(Ctrl(VirtualKey.Z)); | ||
VerifyReplPromptConsistency("< ![CDATA[]] >", string.Empty); | ||
SendKeys(Ctrl(VirtualKey.Y)); | ||
VerifyLastReplInput(" 2 + 4 "); | ||
SendKeys(VirtualKey.Enter); | ||
WaitForReplOutput("6"); | ||
} | ||
|
||
[Fact] | ||
public void CutDeletePasteSelectAll() | ||
{ | ||
SendKeys("Text"); | ||
ExecuteCommand("Edit.LineStart"); | ||
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); | ||
} | ||
} | ||
} |
97 changes: 0 additions & 97 deletions
97
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveDemo.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.