@@ -26,6 +26,9 @@ public class NunitTests
2626 [ AssertionDiagnostic ( "ClassicAssert.True(bool.Parse(\" true\" ){0});" ) ]
2727 [ AssertionDiagnostic ( "ClassicAssert.IsTrue(actual{0});" ) ]
2828 [ 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);" ) ]
2932 [ Implemented ]
3033 public void Nunit4_AssertTrue_TestAnalyzer ( string assertion ) => Nunit4VerifyDiagnostic ( "bool actual" , assertion ) ;
3134
@@ -91,6 +94,15 @@ public class NunitTests
9194 [ AssertionCodeFix (
9295 oldAssertion : "ClassicAssert.IsTrue(actual == false{0});" ,
9396 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();" ) ]
94106 [ Implemented ]
95107 public void Nunit4_AssertTrue_TestCodeFix ( string oldAssertion , string newAssertion ) => Nunit4VerifyFix ( "bool actual" , oldAssertion , newAssertion ) ;
96108
@@ -109,6 +121,8 @@ public class NunitTests
109121 [ AssertionDiagnostic ( "ClassicAssert.False(bool.Parse(\" false\" ){0});" ) ]
110122 [ AssertionDiagnostic ( "ClassicAssert.IsFalse(actual{0});" ) ]
111123 [ AssertionDiagnostic ( "ClassicAssert.IsFalse(bool.Parse(\" false\" ){0});" ) ]
124+ [ AssertionDiagnostic ( "Assert.That(actual, Is.False);" ) ]
125+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Not.True);" ) ]
112126 [ Implemented ]
113127 public void Nunit4_AssertFalse_TestAnalyzer ( string assertion ) => Nunit4VerifyDiagnostic ( "bool actual" , assertion ) ;
114128
@@ -147,6 +161,12 @@ public class NunitTests
147161 [ AssertionCodeFix (
148162 oldAssertion : "ClassicAssert.IsFalse(bool.Parse(\" false\" ){0});" ,
149163 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();" ) ]
150170 [ Implemented ]
151171 public void Nunit4_AssertFalse_TestCodeFix ( string oldAssertion , string newAssertion ) => Nunit4VerifyFix ( "bool actual" , oldAssertion , newAssertion ) ;
152172
@@ -160,6 +180,7 @@ public class NunitTests
160180 [ DataTestMethod ]
161181 [ AssertionDiagnostic ( "ClassicAssert.Null(actual{0});" ) ]
162182 [ AssertionDiagnostic ( "ClassicAssert.IsNull(actual{0});" ) ]
183+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Null);" ) ]
163184 [ Implemented ]
164185 public void Nunit4_AssertNull_TestAnalyzer ( string assertion ) => Nunit4VerifyDiagnostic ( "object actual" , assertion ) ;
165186
@@ -183,6 +204,9 @@ public class NunitTests
183204 [ AssertionCodeFix (
184205 oldAssertion : "ClassicAssert.IsNull(actual{0});" ,
185206 newAssertion : "actual.Should().BeNull({0});" ) ]
207+ [ AssertionCodeFix (
208+ oldAssertion : "Assert.That(actual, Is.Null);" ,
209+ newAssertion : "actual.Should().BeNull();" ) ]
186210 [ Implemented ]
187211 public void Nunit4_AssertNull_TestCodeFix ( string oldAssertion , string newAssertion ) => Nunit4VerifyFix ( "object actual" , oldAssertion , newAssertion ) ;
188212
@@ -196,6 +220,7 @@ public class NunitTests
196220 [ DataTestMethod ]
197221 [ AssertionDiagnostic ( "ClassicAssert.NotNull(actual{0});" ) ]
198222 [ AssertionDiagnostic ( "ClassicAssert.IsNotNull(actual{0});" ) ]
223+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Not.Null);" ) ]
199224 [ Implemented ]
200225 public void Nunit4_AssertNotNull_TestAnalyzer ( string assertion ) => Nunit4VerifyDiagnostic ( "object actual" , assertion ) ;
201226
@@ -219,6 +244,9 @@ public class NunitTests
219244 [ AssertionCodeFix (
220245 oldAssertion : "ClassicAssert.IsNotNull(actual{0});" ,
221246 newAssertion : "actual.Should().NotBeNull({0});" ) ]
247+ [ AssertionCodeFix (
248+ oldAssertion : "Assert.That(actual, Is.Not.Null);" ,
249+ newAssertion : "actual.Should().NotBeNull();" ) ]
222250 [ Implemented ]
223251 public void Nunit4_AssertNotNull_TestCodeFix ( string oldAssertion , string newAssertion ) => Nunit4VerifyFix ( "object actual" , oldAssertion , newAssertion ) ;
224252
@@ -255,6 +283,7 @@ public void Nunit3_AssertIsEmpty_TestAnalyzer(string assertion)
255283
256284 [ DataTestMethod ]
257285 [ AssertionDiagnostic ( "ClassicAssert.IsEmpty(actual{0});" ) ]
286+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Empty);" ) ]
258287 [ Implemented ]
259288 public void Nunit4_AssertIsEmpty_TestAnalyzer ( string assertion )
260289 {
@@ -284,6 +313,9 @@ public void Nunit3_AssertIsEmpty_TestCodeFix(string oldAssertion, string newAsse
284313 [ AssertionCodeFix (
285314 oldAssertion : "ClassicAssert.IsEmpty(actual{0});" ,
286315 newAssertion : "actual.Should().BeEmpty({0});" ) ]
316+ [ AssertionCodeFix (
317+ oldAssertion : "Assert.That(actual, Is.Empty);" ,
318+ newAssertion : "actual.Should().BeEmpty();" ) ]
287319 [ Implemented ]
288320 public void Nunit4_AssertIsEmpty_TestCodeFix ( string oldAssertion , string newAssertion )
289321 {
@@ -308,6 +340,7 @@ public void Nunit3_AssertIsNotEmpty_TestAnalyzer(string assertion)
308340
309341 [ DataTestMethod ]
310342 [ AssertionDiagnostic ( "ClassicAssert.IsNotEmpty(actual{0});" ) ]
343+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Not.Empty);" ) ]
311344 [ Implemented ]
312345 public void Nunit4_AssertIsNotEmpty_TestAnalyzer ( string assertion )
313346 {
@@ -337,6 +370,9 @@ public void Nunit3_AssertIsNotEmpty_TestCodeFix(string oldAssertion, string newA
337370 [ AssertionCodeFix (
338371 oldAssertion : "ClassicAssert.IsNotEmpty(actual{0});" ,
339372 newAssertion : "actual.Should().NotBeEmpty({0});" ) ]
373+ [ AssertionCodeFix (
374+ oldAssertion : "Assert.That(actual, Is.Not.Empty);" ,
375+ newAssertion : "actual.Should().NotBeEmpty();" ) ]
340376 [ Implemented ]
341377 public void Nunit4_AssertIsNotEmpty_TestCodeFix ( string oldAssertion , string newAssertion )
342378 {
@@ -348,6 +384,7 @@ public void Nunit4_AssertIsNotEmpty_TestCodeFix(string oldAssertion, string newA
348384
349385 [ DataTestMethod ]
350386 [ AssertionDiagnostic ( "Assert.Zero(actual{0});" ) ]
387+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Zero{0});" ) ]
351388 [ Implemented ]
352389 public void Nunit3_AssertZero_TestAnalyzer ( string assertion )
353390 {
@@ -362,6 +399,7 @@ public void Nunit3_AssertZero_TestAnalyzer(string assertion)
362399
363400 [ DataTestMethod ]
364401 [ AssertionDiagnostic ( "ClassicAssert.Zero(actual{0});" ) ]
402+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Zero);" ) ]
365403 [ Implemented ]
366404 public void Nunit4_AssertZero_TestAnalyzer ( string assertion )
367405 {
@@ -378,6 +416,9 @@ public void Nunit4_AssertZero_TestAnalyzer(string assertion)
378416 [ AssertionCodeFix (
379417 oldAssertion : "Assert.Zero(actual{0});" ,
380418 newAssertion : "actual.Should().Be(0{0});" ) ]
419+ [ AssertionCodeFix (
420+ oldAssertion : "Assert.That(actual, Is.Zero{0});" ,
421+ newAssertion : "actual.Should().Be(0{0});" ) ]
381422 [ Implemented ]
382423 public void Nunit3_AssertZero_TestCodeFix ( string oldAssertion , string newAssertion )
383424 {
@@ -394,6 +435,9 @@ public void Nunit3_AssertZero_TestCodeFix(string oldAssertion, string newAsserti
394435 [ AssertionCodeFix (
395436 oldAssertion : "ClassicAssert.Zero(actual{0});" ,
396437 newAssertion : "actual.Should().Be(0{0});" ) ]
438+ [ AssertionCodeFix (
439+ oldAssertion : "Assert.That(actual, Is.Zero);" ,
440+ newAssertion : "actual.Should().Be(0);" ) ]
397441 [ Implemented ]
398442 public void Nunit4_AssertZero_TestCodeFix ( string oldAssertion , string newAssertion )
399443 {
@@ -408,6 +452,7 @@ public void Nunit4_AssertZero_TestCodeFix(string oldAssertion, string newAsserti
408452
409453 [ DataTestMethod ]
410454 [ AssertionDiagnostic ( "Assert.NotZero(actual{0});" ) ]
455+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Not.Zero{0});" ) ]
411456 [ Implemented ]
412457 public void Nunit3_AssertNotZero_TestAnalyzer ( string assertion )
413458 {
@@ -422,6 +467,7 @@ public void Nunit3_AssertNotZero_TestAnalyzer(string assertion)
422467
423468 [ DataTestMethod ]
424469 [ AssertionDiagnostic ( "ClassicAssert.NotZero(actual{0});" ) ]
470+ [ AssertionDiagnostic ( "Assert.That(actual, Is.Not.Zero);" ) ]
425471 [ Implemented ]
426472 public void Nunit4_AssertNotZero_TestAnalyzer ( string assertion )
427473 {
@@ -438,6 +484,9 @@ public void Nunit4_AssertNotZero_TestAnalyzer(string assertion)
438484 [ AssertionCodeFix (
439485 oldAssertion : "Assert.NotZero(actual{0});" ,
440486 newAssertion : "actual.Should().NotBe(0{0});" ) ]
487+ [ AssertionCodeFix (
488+ oldAssertion : "Assert.That(actual, Is.Not.Zero{0});" ,
489+ newAssertion : "actual.Should().NotBe(0{0});" ) ]
441490 [ Implemented ]
442491 public void Nunit3_AssertNotZero_TestCodeFix ( string oldAssertion , string newAssertion )
443492 {
@@ -454,6 +503,9 @@ public void Nunit3_AssertNotZero_TestCodeFix(string oldAssertion, string newAsse
454503 [ AssertionCodeFix (
455504 oldAssertion : "ClassicAssert.NotZero(actual{0});" ,
456505 newAssertion : "actual.Should().NotBe(0{0});" ) ]
506+ [ AssertionCodeFix (
507+ oldAssertion : "Assert.That(actual, Is.Not.Zero);" ,
508+ newAssertion : "actual.Should().NotBe(0);" ) ]
457509 [ Implemented ]
458510 public void Nunit4_AssertNotZero_TestCodeFix ( string oldAssertion , string newAssertion )
459511 {
0 commit comments