@@ -26,6 +26,9 @@ public class NunitTests
26
26
[ AssertionDiagnostic ( "ClassicAssert.True(bool.Parse(\" true\" ){0});" ) ]
27
27
[ AssertionDiagnostic ( "ClassicAssert.IsTrue(actual{0});" ) ]
28
28
[ AssertionDiagnostic ( "ClassicAssert.IsTrue(bool.Parse(\" true\" ){0});" ) ]
29
+ [ AssertionDiagnostic ( "Assert.That(actual);" ) ]
30
+ [ AssertionDiagnostic ( "Assert.That(actual, Is.True);" ) ]
31
+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Not.False);" ) ]
29
32
[ Implemented ]
30
33
public void Nunit4_AssertTrue_TestAnalyzer ( string assertion ) => Nunit4VerifyDiagnostic ( "bool actual" , assertion ) ;
31
34
@@ -91,6 +94,15 @@ public class NunitTests
91
94
[ AssertionCodeFix (
92
95
oldAssertion : "ClassicAssert.IsTrue(actual == false{0});" ,
93
96
newAssertion : "(actual == false).Should().BeTrue({0});" ) ]
97
+ [ AssertionCodeFix (
98
+ oldAssertion : "Assert.That(actual);" ,
99
+ newAssertion : "actual.Should().BeTrue();" ) ]
100
+ [ AssertionCodeFix (
101
+ oldAssertion : "Assert.That(actual, Is.True);" ,
102
+ newAssertion : "actual.Should().BeTrue();" ) ]
103
+ [ AssertionCodeFix (
104
+ oldAssertion : "Assert.That(actual, Is.Not.False);" ,
105
+ newAssertion : "actual.Should().BeTrue();" ) ]
94
106
[ Implemented ]
95
107
public void Nunit4_AssertTrue_TestCodeFix ( string oldAssertion , string newAssertion ) => Nunit4VerifyFix ( "bool actual" , oldAssertion , newAssertion ) ;
96
108
@@ -109,6 +121,8 @@ public class NunitTests
109
121
[ AssertionDiagnostic ( "ClassicAssert.False(bool.Parse(\" false\" ){0});" ) ]
110
122
[ AssertionDiagnostic ( "ClassicAssert.IsFalse(actual{0});" ) ]
111
123
[ AssertionDiagnostic ( "ClassicAssert.IsFalse(bool.Parse(\" false\" ){0});" ) ]
124
+ [ AssertionDiagnostic ( "Assert.That(actual, Is.False);" ) ]
125
+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Not.True);" ) ]
112
126
[ Implemented ]
113
127
public void Nunit4_AssertFalse_TestAnalyzer ( string assertion ) => Nunit4VerifyDiagnostic ( "bool actual" , assertion ) ;
114
128
@@ -147,6 +161,12 @@ public class NunitTests
147
161
[ AssertionCodeFix (
148
162
oldAssertion : "ClassicAssert.IsFalse(bool.Parse(\" false\" ){0});" ,
149
163
newAssertion : "bool.Parse(\" false\" ).Should().BeFalse({0});" ) ]
164
+ [ AssertionCodeFix (
165
+ oldAssertion : "Assert.That(actual, Is.False);" ,
166
+ newAssertion : "actual.Should().BeFalse();" ) ]
167
+ [ AssertionCodeFix (
168
+ oldAssertion : "Assert.That(actual, Is.Not.True);" ,
169
+ newAssertion : "actual.Should().BeFalse();" ) ]
150
170
[ Implemented ]
151
171
public void Nunit4_AssertFalse_TestCodeFix ( string oldAssertion , string newAssertion ) => Nunit4VerifyFix ( "bool actual" , oldAssertion , newAssertion ) ;
152
172
@@ -160,6 +180,7 @@ public class NunitTests
160
180
[ DataTestMethod ]
161
181
[ AssertionDiagnostic ( "ClassicAssert.Null(actual{0});" ) ]
162
182
[ AssertionDiagnostic ( "ClassicAssert.IsNull(actual{0});" ) ]
183
+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Null);" ) ]
163
184
[ Implemented ]
164
185
public void Nunit4_AssertNull_TestAnalyzer ( string assertion ) => Nunit4VerifyDiagnostic ( "object actual" , assertion ) ;
165
186
@@ -183,6 +204,9 @@ public class NunitTests
183
204
[ AssertionCodeFix (
184
205
oldAssertion : "ClassicAssert.IsNull(actual{0});" ,
185
206
newAssertion : "actual.Should().BeNull({0});" ) ]
207
+ [ AssertionCodeFix (
208
+ oldAssertion : "Assert.That(actual, Is.Null);" ,
209
+ newAssertion : "actual.Should().BeNull();" ) ]
186
210
[ Implemented ]
187
211
public void Nunit4_AssertNull_TestCodeFix ( string oldAssertion , string newAssertion ) => Nunit4VerifyFix ( "object actual" , oldAssertion , newAssertion ) ;
188
212
@@ -196,6 +220,7 @@ public class NunitTests
196
220
[ DataTestMethod ]
197
221
[ AssertionDiagnostic ( "ClassicAssert.NotNull(actual{0});" ) ]
198
222
[ AssertionDiagnostic ( "ClassicAssert.IsNotNull(actual{0});" ) ]
223
+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Not.Null);" ) ]
199
224
[ Implemented ]
200
225
public void Nunit4_AssertNotNull_TestAnalyzer ( string assertion ) => Nunit4VerifyDiagnostic ( "object actual" , assertion ) ;
201
226
@@ -219,6 +244,9 @@ public class NunitTests
219
244
[ AssertionCodeFix (
220
245
oldAssertion : "ClassicAssert.IsNotNull(actual{0});" ,
221
246
newAssertion : "actual.Should().NotBeNull({0});" ) ]
247
+ [ AssertionCodeFix (
248
+ oldAssertion : "Assert.That(actual, Is.Not.Null);" ,
249
+ newAssertion : "actual.Should().NotBeNull();" ) ]
222
250
[ Implemented ]
223
251
public void Nunit4_AssertNotNull_TestCodeFix ( string oldAssertion , string newAssertion ) => Nunit4VerifyFix ( "object actual" , oldAssertion , newAssertion ) ;
224
252
@@ -255,6 +283,7 @@ public void Nunit3_AssertIsEmpty_TestAnalyzer(string assertion)
255
283
256
284
[ DataTestMethod ]
257
285
[ AssertionDiagnostic ( "ClassicAssert.IsEmpty(actual{0});" ) ]
286
+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Empty);" ) ]
258
287
[ Implemented ]
259
288
public void Nunit4_AssertIsEmpty_TestAnalyzer ( string assertion )
260
289
{
@@ -284,6 +313,9 @@ public void Nunit3_AssertIsEmpty_TestCodeFix(string oldAssertion, string newAsse
284
313
[ AssertionCodeFix (
285
314
oldAssertion : "ClassicAssert.IsEmpty(actual{0});" ,
286
315
newAssertion : "actual.Should().BeEmpty({0});" ) ]
316
+ [ AssertionCodeFix (
317
+ oldAssertion : "Assert.That(actual, Is.Empty);" ,
318
+ newAssertion : "actual.Should().BeEmpty();" ) ]
287
319
[ Implemented ]
288
320
public void Nunit4_AssertIsEmpty_TestCodeFix ( string oldAssertion , string newAssertion )
289
321
{
@@ -308,6 +340,7 @@ public void Nunit3_AssertIsNotEmpty_TestAnalyzer(string assertion)
308
340
309
341
[ DataTestMethod ]
310
342
[ AssertionDiagnostic ( "ClassicAssert.IsNotEmpty(actual{0});" ) ]
343
+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Not.Empty);" ) ]
311
344
[ Implemented ]
312
345
public void Nunit4_AssertIsNotEmpty_TestAnalyzer ( string assertion )
313
346
{
@@ -337,6 +370,9 @@ public void Nunit3_AssertIsNotEmpty_TestCodeFix(string oldAssertion, string newA
337
370
[ AssertionCodeFix (
338
371
oldAssertion : "ClassicAssert.IsNotEmpty(actual{0});" ,
339
372
newAssertion : "actual.Should().NotBeEmpty({0});" ) ]
373
+ [ AssertionCodeFix (
374
+ oldAssertion : "Assert.That(actual, Is.Not.Empty);" ,
375
+ newAssertion : "actual.Should().NotBeEmpty();" ) ]
340
376
[ Implemented ]
341
377
public void Nunit4_AssertIsNotEmpty_TestCodeFix ( string oldAssertion , string newAssertion )
342
378
{
@@ -348,6 +384,7 @@ public void Nunit4_AssertIsNotEmpty_TestCodeFix(string oldAssertion, string newA
348
384
349
385
[ DataTestMethod ]
350
386
[ AssertionDiagnostic ( "Assert.Zero(actual{0});" ) ]
387
+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Zero{0});" ) ]
351
388
[ Implemented ]
352
389
public void Nunit3_AssertZero_TestAnalyzer ( string assertion )
353
390
{
@@ -362,6 +399,7 @@ public void Nunit3_AssertZero_TestAnalyzer(string assertion)
362
399
363
400
[ DataTestMethod ]
364
401
[ AssertionDiagnostic ( "ClassicAssert.Zero(actual{0});" ) ]
402
+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Zero);" ) ]
365
403
[ Implemented ]
366
404
public void Nunit4_AssertZero_TestAnalyzer ( string assertion )
367
405
{
@@ -378,6 +416,9 @@ public void Nunit4_AssertZero_TestAnalyzer(string assertion)
378
416
[ AssertionCodeFix (
379
417
oldAssertion : "Assert.Zero(actual{0});" ,
380
418
newAssertion : "actual.Should().Be(0{0});" ) ]
419
+ [ AssertionCodeFix (
420
+ oldAssertion : "Assert.That(actual, Is.Zero{0});" ,
421
+ newAssertion : "actual.Should().Be(0{0});" ) ]
381
422
[ Implemented ]
382
423
public void Nunit3_AssertZero_TestCodeFix ( string oldAssertion , string newAssertion )
383
424
{
@@ -394,6 +435,9 @@ public void Nunit3_AssertZero_TestCodeFix(string oldAssertion, string newAsserti
394
435
[ AssertionCodeFix (
395
436
oldAssertion : "ClassicAssert.Zero(actual{0});" ,
396
437
newAssertion : "actual.Should().Be(0{0});" ) ]
438
+ [ AssertionCodeFix (
439
+ oldAssertion : "Assert.That(actual, Is.Zero);" ,
440
+ newAssertion : "actual.Should().Be(0);" ) ]
397
441
[ Implemented ]
398
442
public void Nunit4_AssertZero_TestCodeFix ( string oldAssertion , string newAssertion )
399
443
{
@@ -408,6 +452,7 @@ public void Nunit4_AssertZero_TestCodeFix(string oldAssertion, string newAsserti
408
452
409
453
[ DataTestMethod ]
410
454
[ AssertionDiagnostic ( "Assert.NotZero(actual{0});" ) ]
455
+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Not.Zero{0});" ) ]
411
456
[ Implemented ]
412
457
public void Nunit3_AssertNotZero_TestAnalyzer ( string assertion )
413
458
{
@@ -422,6 +467,7 @@ public void Nunit3_AssertNotZero_TestAnalyzer(string assertion)
422
467
423
468
[ DataTestMethod ]
424
469
[ AssertionDiagnostic ( "ClassicAssert.NotZero(actual{0});" ) ]
470
+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Not.Zero);" ) ]
425
471
[ Implemented ]
426
472
public void Nunit4_AssertNotZero_TestAnalyzer ( string assertion )
427
473
{
@@ -438,6 +484,9 @@ public void Nunit4_AssertNotZero_TestAnalyzer(string assertion)
438
484
[ AssertionCodeFix (
439
485
oldAssertion : "Assert.NotZero(actual{0});" ,
440
486
newAssertion : "actual.Should().NotBe(0{0});" ) ]
487
+ [ AssertionCodeFix (
488
+ oldAssertion : "Assert.That(actual, Is.Not.Zero{0});" ,
489
+ newAssertion : "actual.Should().NotBe(0{0});" ) ]
441
490
[ Implemented ]
442
491
public void Nunit3_AssertNotZero_TestCodeFix ( string oldAssertion , string newAssertion )
443
492
{
@@ -454,6 +503,9 @@ public void Nunit3_AssertNotZero_TestCodeFix(string oldAssertion, string newAsse
454
503
[ AssertionCodeFix (
455
504
oldAssertion : "ClassicAssert.NotZero(actual{0});" ,
456
505
newAssertion : "actual.Should().NotBe(0{0});" ) ]
506
+ [ AssertionCodeFix (
507
+ oldAssertion : "Assert.That(actual, Is.Not.Zero);" ,
508
+ newAssertion : "actual.Should().NotBe(0);" ) ]
457
509
[ Implemented ]
458
510
public void Nunit4_AssertNotZero_TestCodeFix ( string oldAssertion , string newAssertion )
459
511
{
0 commit comments