Skip to content

Commit 6dc4d8e

Browse files
youssef-backport-botCopilotYoussef1313
authored
Fix UseAsync property in TestMethodAttribute derived classes to use type checks by @Copilot in #5708 (backport to rel/3.9) (#5710)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Youssef1313 <[email protected]>
1 parent 6a3dbf1 commit 6dc4d8e

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/TestFramework/TestFramework.Extensions/Attributes/UWP_UITestMethodAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer;
1010
/// </summary>
1111
public class UITestMethodAttribute : TestMethodAttribute
1212
{
13-
private protected override bool UseAsync => true;
13+
private protected override bool UseAsync => GetType() == typeof(UITestMethodAttribute);
1414

1515
/// <inheritdoc cref="ExecuteAsync(ITestMethod)" />
1616
public override TestResult[] Execute(ITestMethod testMethod) => base.Execute(testMethod);

src/TestFramework/TestFramework.Extensions/Attributes/WinUI_UITestMethodAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public UITestMethodAttribute(string displayName)
3434
{
3535
}
3636

37-
private protected override bool UseAsync => true;
37+
private protected override bool UseAsync => GetType() == typeof(UITestMethodAttribute);
3838

3939
/// <summary>
4040
/// Gets or sets the <see cref="UI.Dispatching.DispatcherQueue"/> that should be used to invoke the UITestMethodAttribute.

src/TestFramework/TestFramework/Attributes/DataSource/DataTestMethodAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting;
1313
[EditorBrowsable(EditorBrowsableState.Never)]
1414
public class DataTestMethodAttribute : TestMethodAttribute
1515
{
16-
private protected override bool UseAsync => true;
16+
private protected override bool UseAsync => GetType() == typeof(DataTestMethodAttribute);
1717

1818
/// <summary>
1919
/// Initializes a new instance of the <see cref="DataTestMethodAttribute"/> class.

src/TestFramework/TestFramework/Attributes/TestMethod/STATestMethodAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting;
99
[AttributeUsage(AttributeTargets.Method)]
1010
public class STATestMethodAttribute : TestMethodAttribute
1111
{
12-
private protected override bool UseAsync => true;
12+
private protected override bool UseAsync => GetType() == typeof(STATestMethodAttribute);
1313

1414
/// <summary>
1515
/// Initializes a new instance of the <see cref="STATestMethodAttribute"/> class.

0 commit comments

Comments
 (0)