@@ -13,10 +13,8 @@ namespace StyleCop.Analyzers.Test.Verifiers
1313 using Microsoft . CodeAnalysis . CSharp . Testing ;
1414 using Microsoft . CodeAnalysis . Diagnostics ;
1515 using Microsoft . CodeAnalysis . Testing ;
16- using Microsoft . CodeAnalysis . Testing . Verifiers ;
1716 using StyleCop . Analyzers . SpacingRules ;
1817 using Xunit ;
19- using Xunit . Sdk ;
2018 using static StyleCopDiagnosticVerifier < StyleCop . Analyzers . SpacingRules . SA1002SemicolonsMustBeSpacedCorrectly > ;
2119
2220 /// <summary>
@@ -38,7 +36,7 @@ void MethodName()
3836" ;
3937
4038 var expected = Diagnostic ( ) ;
41- var ex = await Assert . ThrowsAnyAsync < XunitException > (
39+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
4240 async ( ) =>
4341 {
4442 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -101,7 +99,7 @@ int PropertyName
10199 // By failing to include a location, the verified thinks we're only trying to verify a project diagnostic.
102100 DiagnosticResult expected = Diagnostic ( ) . WithArguments ( string . Empty , "followed" ) ;
103101
104- var ex = await Assert . ThrowsAnyAsync < XunitException > (
102+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
105103 async ( ) =>
106104 {
107105 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -117,13 +115,9 @@ int PropertyName
117115 + $ "Actual diagnostic:{ Environment . NewLine } "
118116 + $ " // /0/Test0.cs(7,33): warning SA1002: Semicolons should be followed by a space{ Environment . NewLine } "
119117 + $ "VerifyCS.Diagnostic().WithSpan(7, 33, 7, 34).WithArguments(\" \" , \" followed\" ),{ Environment . NewLine } "
120- + $ "{ Environment . NewLine } "
121- + $ "{ Environment . NewLine } "
122- + $ "Assert.Equal() Failure{ Environment . NewLine } "
123- + $ "Expected: None{ Environment . NewLine } "
124- + $ "Actual: SourceFile(/0/Test0.cs[102..103))";
118+ + $ "{ Environment . NewLine } ";
125119
126- new XUnitVerifier ( ) . EqualOrDiff ( expectedMessage , ex . Message ) ;
120+ new DefaultVerifier ( ) . EqualOrDiff ( expectedMessage , ex . Message ) ;
127121 }
128122
129123 [ Fact ]
@@ -140,7 +134,7 @@ int PropertyName
140134}
141135" ;
142136
143- var ex = await Assert . ThrowsAnyAsync < XunitException > (
137+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
144138 async ( ) =>
145139 {
146140 await VerifyCSharpDiagnosticAsync ( testCode , DiagnosticResult . EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -162,10 +156,10 @@ void MethodName()
162156}
163157" ;
164158
165- var ex = await Assert . ThrowsAnyAsync < XunitException > (
159+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
166160 async ( ) =>
167161 {
168- await CSharpCodeFixVerifier < ErrorThrowingAnalyzer , EmptyCodeFixProvider , XUnitVerifier > . VerifyAnalyzerAsync ( testCode , DiagnosticResult . EmptyDiagnosticResults ) . ConfigureAwait ( false ) ;
162+ await CSharpCodeFixVerifier < ErrorThrowingAnalyzer , EmptyCodeFixProvider , DefaultVerifier > . VerifyAnalyzerAsync ( testCode , DiagnosticResult . EmptyDiagnosticResults ) . ConfigureAwait ( false ) ;
169163 } ) . ConfigureAwait ( false ) ;
170164 Assert . StartsWith ( $ "Context: Diagnostics of test state{ Environment . NewLine } Mismatch between number of diagnostics returned, expected \" 0\" actual \" 1\" ", ex . Message ) ;
171165 Assert . Contains ( "error AD0001" , ex . Message ) ;
@@ -187,7 +181,7 @@ Int32 PropertyName
187181
188182 DiagnosticResult expected = Diagnostic ( ) . WithArguments ( string . Empty , "followed" ) . WithLocation ( 7 , 33 ) ;
189183
190- var ex = await Assert . ThrowsAnyAsync < XunitException > (
184+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
191185 async ( ) =>
192186 {
193187 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -213,7 +207,7 @@ Int32 PropertyName
213207
214208 DiagnosticResult expected = Diagnostic ( ) . WithArguments ( string . Empty , "followed" ) . WithLocation ( 8 , 33 ) ;
215209
216- var ex = await Assert . ThrowsAnyAsync < XunitException > (
210+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
217211 async ( ) =>
218212 {
219213 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -239,7 +233,7 @@ int PropertyName
239233 var descriptor = new DiagnosticDescriptor ( "SA9999" , "Title" , "Message" , "Category" , DiagnosticSeverity . Warning , isEnabledByDefault : true ) ;
240234 DiagnosticResult expected = Diagnostic ( descriptor ) . WithLocation ( 7 , 33 ) ;
241235
242- var ex = await Assert . ThrowsAnyAsync < XunitException > (
236+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
243237 async ( ) =>
244238 {
245239 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -263,7 +257,7 @@ int PropertyName
263257
264258 DiagnosticResult expected = Diagnostic ( ) . WithLocation ( 7 , 33 ) . WithSeverity ( DiagnosticSeverity . Error ) ;
265259
266- var ex = await Assert . ThrowsAnyAsync < XunitException > (
260+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
267261 async ( ) =>
268262 {
269263 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -287,7 +281,7 @@ int PropertyName
287281
288282 DiagnosticResult expected = Diagnostic ( ) . WithArguments ( string . Empty , "followed" ) . WithLocation ( 8 , 33 ) ;
289283
290- var ex = await Assert . ThrowsAnyAsync < XunitException > (
284+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
291285 async ( ) =>
292286 {
293287 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -316,7 +310,7 @@ int PropertyName
316310 Diagnostic ( ) . WithArguments ( string . Empty , "followed" ) . WithLocation ( 7 , 34 ) ,
317311 } ;
318312
319- var ex = await Assert . ThrowsAnyAsync < XunitException > (
313+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
320314 async ( ) =>
321315 {
322316 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -340,7 +334,7 @@ int PropertyName
340334
341335 DiagnosticResult expected = Diagnostic ( ) . WithArguments ( string . Empty , "followed" ) . WithLocation ( 7 , 34 ) ;
342336
343- var ex = await Assert . ThrowsAnyAsync < XunitException > (
337+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
344338 async ( ) =>
345339 {
346340 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -364,7 +358,7 @@ int PropertyName
364358
365359 DiagnosticResult expected = Diagnostic ( ) . WithArguments ( string . Empty , "followed" ) . WithSpan ( 7 , 33 , 7 , 35 ) ;
366360
367- var ex = await Assert . ThrowsAnyAsync < XunitException > (
361+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
368362 async ( ) =>
369363 {
370364 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -388,7 +382,7 @@ int PropertyName
388382
389383 DiagnosticResult expected = Diagnostic ( ) . WithArguments ( string . Empty , "bogus argument" ) . WithLocation ( 7 , 33 ) ;
390384
391- var ex = await Assert . ThrowsAnyAsync < XunitException > (
385+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
392386 async ( ) =>
393387 {
394388 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -412,7 +406,7 @@ int PropertyName
412406
413407 DiagnosticResult expected = Diagnostic ( ) . WithArguments ( string . Empty , "bogus argument" ) . WithLocation ( 7 , 33 ) . WithLocation ( 8 , 34 ) ;
414408
415- var ex = await Assert . ThrowsAnyAsync < XunitException > (
409+ var ex = await Assert . ThrowsAsync < InvalidOperationException > (
416410 async ( ) =>
417411 {
418412 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
0 commit comments