diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractEditorTest.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractEditorTest.cs
index 2e73cf47560d374c0427687a422dd0e0eec2232e..51e1d6d9bf463116c40fee6654fd431d4f23acc9 100644
--- a/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractEditorTest.cs
+++ b/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractEditorTest.cs
@@ -98,8 +98,8 @@ protected void EditWinFormButtonProperty(string buttonName, string propertyName,
protected void EditWinFormsButtonEvent(string buttonName, string eventName, string eventHandlerName)
=> VisualStudio.Instance.Editor.EditWinFormButtonEvent(buttonName, eventName, eventHandlerName);
- protected void VerifyWinFormButtonPropertySet(string buttonName, string propertyName, string expectedPropertyValue)
- => VisualStudio.Instance.Editor.VerifyWinFormButtonPropertySet(buttonName, propertyName, expectedPropertyValue);
+ protected string GetWinFormButtonPropertyValue(string buttonName, string propertyName)
+ => VisualStudio.Instance.Editor.GetWinFormButtonPropertyValue(buttonName, propertyName);
protected void SelectTextInCurrentDocument(string text)
{
diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpSignatureHelp.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpSignatureHelp.cs
index 71b6fbb746b390c7944383c51af14cd9e6f547ee..b0b63094a61ef04ef4c9eaee40793a58e42bd549 100644
--- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpSignatureHelp.cs
+++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpSignatureHelp.cs
@@ -1,4 +1,6 @@
-using Microsoft.CodeAnalysis;
+// 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.CodeAnalysis;
using Microsoft.VisualStudio.IntegrationTest.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities.Common;
using Microsoft.VisualStudio.IntegrationTest.Utilities.Input;
@@ -39,7 +41,7 @@ void M()
/// an integer, anything you like.
/// returns an object of type C
C Method(int i, int i2) { return null; }
-
+
///
/// Hello Generic World!
///
@@ -48,7 +50,7 @@ void M()
/// Null
C GenericMethod(T1 i) { return null; }
C GenericMethod(T1 i, T2 i2) { return null; }
-
+
///
/// Complex Method Params
///
@@ -98,7 +100,7 @@ void M()
/// an integer, anything you like.
/// returns an object of type C
C Method(int i, int i2) { return null; }
-
+
///
/// Hello Generic World!
///
@@ -107,7 +109,7 @@ void M()
/// Null
C GenericMethod(T1 i) { return null; }
C GenericMethod(T1 i, T2 i2) { return null; }
-
+
///
/// Complex Method Params
///
@@ -146,7 +148,7 @@ void M()
/// an integer, anything you like.
/// returns an object of type C
C Method(int i, int i2) { return null; }
-
+
///
/// Hello Generic World!
///
@@ -155,7 +157,7 @@ void M()
/// Null
C GenericMethod(T1 i) { return null; }
C GenericMethod(T1 i, T2 i2) { return null; }
-
+
///
/// Complex Method Params
///
diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpWinForms.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpWinForms.cs
index 97cf8804d1dc5d4d1c7cd94d8cef34e62f432ac8..446f4fa42b37a626388e70cbfb6a10f16daffd60 100644
--- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpWinForms.cs
+++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpWinForms.cs
@@ -1,12 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// 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.CodeAnalysis;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities;
-using Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess;
using Xunit;
namespace Roslyn.VisualStudio.IntegrationTests.CSharp
@@ -49,7 +45,9 @@ public void Change_Control_Property_In_Code()
OpenFileWithDesigner(ProjectName, "Form1.cs");
AddWinFormButton("SomeButton");
EditWinFormButtonProperty(buttonName: "SomeButton", propertyName: "Text", propertyValue: "ButtonTextGoesHere");
- VerifyWinFormButtonPropertySet(buttonName: "SomeButton", propertyName: "Text", expectedPropertyValue: "ButtonTextGoesHere");
+ var expectedPropertyValue = "ButtonTextGoesHere";
+ var actualPropertyValue = GetWinFormButtonPropertyValue(buttonName: "SomeButton", propertyName: "Text");
+ Assert.Equal(expectedPropertyValue, actualPropertyValue);
CloseFile(ProjectName, "Form1.cs", saveFile: true);
// Change the control's text in designer.cs code
OpenFile(ProjectName, "Form1.Designer.cs");
@@ -61,7 +59,9 @@ public void Change_Control_Property_In_Code()
CloseFile(ProjectName, "Form1.Designer.cs", saveFile: true);
// Verify that the control text has changed in the designer
OpenFileWithDesigner(ProjectName, "Form1.cs");
- VerifyWinFormButtonPropertySet(buttonName: "SomeButton", propertyName: "Text", expectedPropertyValue: "GibberishText");
+ expectedPropertyValue = "GibberishText";
+ actualPropertyValue = GetWinFormButtonPropertyValue(buttonName: "SomeButton", propertyName: "Text");
+ Assert.Equal(expectedPropertyValue, actualPropertyValue);
}
[Fact, Trait(Traits.Feature, Traits.Features.WinForms)]
diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs
index 12da68d8291296f4abed91f5a5cda8e629ea652e..3c8af6c4107841dffaf3a806e1d7565a6cce1add 100644
--- a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs
+++ b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs
@@ -8,8 +8,8 @@
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
-using System.Windows.Forms;
using System.Windows.Automation;
+using System.Windows.Forms;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Editor.Implementation.Suggestions;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
@@ -159,7 +159,6 @@ public void PlaceCaret(string marker, int charsOffset, int occurrence, bool exte
if (occurrence > 0)
{
-
var result = EnvDTE.vsFindResult.vsFindResultNotFound;
for (var i = 0; i < occurrence; i++)
{
@@ -770,16 +769,12 @@ void ComponentChanged(object sender, ComponentChangedEventArgs e)
}
}
- public void VerifyWinFormButtonPropertySet(string buttonName, string propertyName, string expectedPropertyValue)
+ public string GetWinFormButtonPropertyValue(string buttonName, string propertyName)
{
var designerHost = (IDesignerHost)GetDTE().ActiveWindow.Object;
var button = designerHost.Container.Components[buttonName];
var properties = TypeDescriptor.GetProperties(button);
- var actualPropertyValue = (string)properties[propertyName].GetValue(button);
- if (actualPropertyValue != expectedPropertyValue)
- {
- throw new Exception($"Property value mismatch for control:property: {buttonName}:{propertyName}, expected: {expectedPropertyValue}, actual: {actualPropertyValue}");
- }
+ return properties[propertyName].GetValue(button) as string;
}
}
}
diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs
index e26f12d5a92a0d565f5a6c8ca73bb137fc7455cc..f84452c1721f8e4de04e3b3c1c7ff46e1f91a9f5 100644
--- a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs
+++ b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs
@@ -333,7 +333,12 @@ public void CloseFile(string projectName, string relativeFilePath, bool saveFile
var fileName = Path.GetFileName(filePath);
var dte = GetDTE();
- var fileToClose = dte.Documents.Cast().FirstOrDefault(document => document.Name.Equals(fileName));
+ var documents = dte.Documents.Cast();
+ var fileToClose = documents.FirstOrDefault(document => document.Name.Equals(fileName));
+ if (fileToClose == null)
+ {
+ throw new InvalidOperationException($"File '{fileName}' not closed because it couldn't be found. Available files: {string.Join(", ", documents.Select(x => x.Name))}.");
+ }
if (saveFile)
{
SaveFile(fileName);
diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.cs b/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.cs
index 56bb350cf3a3cb5329308f8ecd2d5dcfd1113b34..e2cc4d73f31a5ee87df1477782ed12a5a42fc636 100644
--- a/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.cs
+++ b/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.cs
@@ -115,8 +115,8 @@ public void EditWinFormButtonProperty(string buttonName, string propertyName, st
public void EditWinFormButtonEvent(string buttonName, string eventName, string eventHandlerName)
=> _inProc.EditWinFormButtonEvent(buttonName, eventName, eventHandlerName);
- public void VerifyWinFormButtonPropertySet(string buttonName, string propertyName, string expectedPropertyValue)
- => _inProc.VerifyWinFormButtonPropertySet(buttonName, propertyName, expectedPropertyValue);
+ public string GetWinFormButtonPropertyValue(string buttonName, string propertyName)
+ => _inProc.GetWinFormButtonPropertyValue(buttonName, propertyName);
///
/// Sends key strokes to the active editor in Visual Studio. Various types are supported by this method: