From 4a1cb0614f520feec96f70fd82eda230e80f3e34 Mon Sep 17 00:00:00 2001 From: David Poeschl Date: Fri, 22 Mar 2019 10:54:42 -0700 Subject: [PATCH] Fix integration test --- .../CSharpRenameFileToMatchTypeRefactoring.cs | 14 +++++++++++++- .../TestUtilities/InProcess/Editor_InProc.cs | 3 +++ .../TestUtilities/OutOfProcess/Editor_OutOfProc.cs | 3 +++ .../TestUtilities/WellKnownCommandNames.cs | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpRenameFileToMatchTypeRefactoring.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpRenameFileToMatchTypeRefactoring.cs index 7d9f635dd32..f4177923615 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpRenameFileToMatchTypeRefactoring.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpRenameFileToMatchTypeRefactoring.cs @@ -67,9 +67,21 @@ public void RenameFileToMatchType_UndoStackPreserved() VisualStudio.Editor.Verify.CurrentLineText("public class MismatchedClassName { }"); VisualStudio.SolutionExplorer.Verify.FileContents(project, "MismatchedClassName.cs", @"public class MismatchedClassName { }"); - // Undo just undoes text changes. The file rename is not undone, and the changes are not saved after the undo + // The first undo is for the file rename. + VisualStudio.Editor.Undo(); + VisualStudio.Editor.Verify.CurrentLineText("public class MismatchedClassName { }"); + VisualStudio.SolutionExplorer.Verify.FileContents(project, "Class1.cs", @"public class MismatchedClassName { }"); + + // The second undo is for the text changes. VisualStudio.Editor.Undo(); VisualStudio.Editor.Verify.CurrentLineText("class MismatchedClassName { }"); + + // Redo the text changes + VisualStudio.Editor.Redo(); + VisualStudio.Editor.Verify.CurrentLineText("public class MismatchedClassName { }"); + + // Redo the file rename + VisualStudio.Editor.Redo(); VisualStudio.SolutionExplorer.Verify.FileContents(project, "MismatchedClassName.cs", @"public class MismatchedClassName { }"); } } diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs index 9daae649656..8953a0c1c42 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs @@ -697,6 +697,9 @@ public void Paste() public void Undo() => ExecuteCommand(WellKnownCommandNames.Edit_Undo); + public void Redo() + => GetDTE().ExecuteCommand(WellKnownCommandNames.Edit_Redo); + protected override ITextBuffer GetBufferContainingCaret(IWpfTextView view) { return view.GetBufferContainingCaret(); diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.cs b/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.cs index 63ec943d71e..ea37c972c0e 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.cs @@ -218,6 +218,9 @@ public void Paste(string text) public void Undo() => _editorInProc.Undo(); + public void Redo() + => _editorInProc.Redo(); + public void NavigateToSendKeys(params object[] keys) => _editorInProc.SendKeysToNavigateTo(keys); diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/WellKnownCommandNames.cs b/src/VisualStudio/IntegrationTest/TestUtilities/WellKnownCommandNames.cs index a3a8525a515..f65d127a953 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/WellKnownCommandNames.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/WellKnownCommandNames.cs @@ -15,6 +15,7 @@ public static class WellKnownCommandNames public const string Edit_QuickInfo = "Edit.QuickInfo"; public const string Edit_ToggleCompletionMode = "Edit.ToggleCompletionMode"; public const string Edit_Undo = "Edit.Undo"; + public const string Edit_Redo = "Edit.Redo"; public const string Edit_SelectionCancel = "Edit.SelectionCancel"; public const string Edit_LineStart = "Edit.LineStart"; public const string Edit_LineEnd = "Edit.LineEnd"; -- GitLab