Skip to content

Commit 3d907e2

Browse files
Fix xUnit1051 warning as error in new unit tests.
1 parent a22fbfe commit 3d907e2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/test/unit/System.Windows.Forms/System/Windows/Forms/ControlTests_InvokeAsync.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ private sealed class TestControl : Control
1212
}
1313

1414
[Fact]
15+
[Diagnostics.CodeAnalysis.SuppressMessage(
16+
category: "Usage",
17+
checkId: "xUnit1051",
18+
Justification = "We need to test a series of specific overloads and/or exceptions.")]
1519
public async Task InvokeAsync_Action_ExecutesOnUIThread()
1620
{
1721
using var control = new TestControl();
@@ -33,6 +37,10 @@ await control.InvokeAsync(
3337
}
3438

3539
[Fact]
40+
[Diagnostics.CodeAnalysis.SuppressMessage(
41+
category: "Usage",
42+
checkId: "xUnit1051",
43+
Justification = "We need to test a series of specific overloads and/or exceptions.")]
3644
public async Task InvokeAsync_FuncT_ExecutesOnUIThread_AndReturnsValue()
3745
{
3846
using var control = new TestControl();
@@ -53,6 +61,10 @@ public async Task InvokeAsync_FuncT_ExecutesOnUIThread_AndReturnsValue()
5361
}
5462

5563
[Fact]
64+
[Diagnostics.CodeAnalysis.SuppressMessage(
65+
category: "Usage",
66+
checkId: "xUnit1051",
67+
Justification = "We need to test a series of specific overloads and/or exceptions.")]
5668
public async Task InvokeAsync_AsyncCallback_ExecutesOnUIThread()
5769
{
5870
using var control = new TestControl();
@@ -74,6 +86,10 @@ await control.InvokeAsync(async ct =>
7486
}
7587

7688
[Fact]
89+
[Diagnostics.CodeAnalysis.SuppressMessage(
90+
category: "Usage",
91+
checkId: "xUnit1051",
92+
Justification = "We need to test a series of specific overloads and/or exceptions.")]
7793
public async Task InvokeAsync_AsyncCallbackT_ExecutesOnUIThread_AndReturnsValue()
7894
{
7995
using var control = new TestControl();
@@ -207,6 +223,10 @@ await Assert.ThrowsAsync<InvalidOperationException>(() =>
207223
}
208224

209225
[Fact]
226+
[Diagnostics.CodeAnalysis.SuppressMessage(
227+
category: "Usage",
228+
checkId: "xUnit1051",
229+
Justification = "We need to test a series of specific overloads and/or exceptions.")]
210230
public async Task InvokeAsync_Propagates_Exception_FromCallback()
211231
{
212232
using var control = new TestControl();
@@ -226,6 +246,10 @@ await Assert.ThrowsAsync<InvalidOperationException>(() =>
226246
}
227247

228248
[Fact]
249+
[Diagnostics.CodeAnalysis.SuppressMessage(
250+
category: "Usage",
251+
checkId: "xUnit1051",
252+
Justification = "We need to test a series of specific overloads and/or exceptions.")]
229253
public async Task InvokeAsync_Reentry_Supported()
230254
{
231255
using var control = new TestControl();
@@ -241,6 +265,10 @@ await control.InvokeAsync(async ct =>
241265
}
242266

243267
[Fact]
268+
[Diagnostics.CodeAnalysis.SuppressMessage(
269+
category: "Usage",
270+
checkId: "xUnit1051",
271+
Justification = "We need to test a series of specific overloads and/or exceptions.")]
244272
public async Task InvokeAsync_MultipleConcurrentCalls_AreThreadSafe()
245273
{
246274
using var control = new TestControl();

0 commit comments

Comments
 (0)