@@ -322,33 +322,26 @@ public void AssertOptionalIntegerAreEqual_TestCodeFix(string oldAssertion, strin
322
322
323
323
[ DataTestMethod ]
324
324
[ AssertionDiagnostic ( "Assert.AreEqual(actual, null{0});" ) ]
325
+ [ AssertionDiagnostic ( "Assert.AreEqual(null, actual{0});" ) ]
325
326
[ Implemented ]
326
- public void AssertOptionalIntegerAndNullAreEqual1_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( "int? actual" , assertion ) ;
327
+ public void AssertOptionalIntegerAndNullAreEqual_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( "int? actual" , assertion ) ;
327
328
328
329
[ DataTestMethod ]
329
330
[ AssertionCodeFix (
330
331
oldAssertion : "Assert.AreEqual(actual, null{0});" ,
331
332
newAssertion : "actual.Should().BeNull({0});" ) ]
332
- [ Implemented ]
333
- public void AssertOptionalIntegerAndNullAreEqual1_TestCodeFix ( string oldAssertion , string newAssertion )
334
- => VerifyCSharpFix ( "int? actual" , oldAssertion , newAssertion ) ;
335
-
336
- [ DataTestMethod ]
337
- [ AssertionDiagnostic ( "Assert.AreEqual(null, actual{0});" ) ]
338
- [ Implemented ]
339
- public void AssertOptionalIntegerAndNullAreEqual2_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( "int? actual" , assertion ) ;
340
-
341
- [ DataTestMethod ]
342
333
[ AssertionCodeFix (
343
334
oldAssertion : "Assert.AreEqual(null, actual{0});" ,
344
335
newAssertion : "actual.Should().BeNull({0});" ) ]
345
336
[ Implemented ]
346
- public void AssertOptionalIntegerAndNullAreEqual2_TestCodeFix ( string oldAssertion , string newAssertion )
337
+ public void AssertOptionalIntegerAndNullAreEqual_TestCodeFix ( string oldAssertion , string newAssertion )
347
338
=> VerifyCSharpFix ( "int? actual" , oldAssertion , newAssertion ) ;
348
339
349
340
[ DataTestMethod ]
350
341
[ AssertionDiagnostic ( "Assert.AreEqual(expected, actual, delta{0});" ) ]
351
342
[ AssertionDiagnostic ( "Assert.AreEqual(expected, actual, 0.6{0});" ) ]
343
+ [ AssertionDiagnostic ( "Assert.AreEqual(actual, 4.2d, 0.6{0});" ) ]
344
+ [ AssertionDiagnostic ( "Assert.AreEqual(4.2d, actual, 0.6{0});" ) ]
352
345
[ Implemented ]
353
346
public void AssertDoubleAreEqual_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( "double actual, double expected, double delta" , assertion ) ;
354
347
@@ -359,13 +352,21 @@ public void AssertOptionalIntegerAndNullAreEqual2_TestCodeFix(string oldAssertio
359
352
[ AssertionCodeFix (
360
353
oldAssertion : "Assert.AreEqual(expected, actual, 0.6{0});" ,
361
354
newAssertion : "actual.Should().BeApproximately(expected, 0.6{0});" ) ]
355
+ [ AssertionCodeFix (
356
+ oldAssertion : "Assert.AreEqual(actual, 4.2d, 0.6{0});" ,
357
+ newAssertion : "actual.Should().BeApproximately(4.2d, 0.6{0});" ) ]
358
+ [ AssertionCodeFix (
359
+ oldAssertion : "Assert.AreEqual(4.2d, actual, 0.6{0});" ,
360
+ newAssertion : "actual.Should().BeApproximately(4.2d, 0.6{0});" ) ]
362
361
[ Implemented ]
363
362
public void AssertDoubleAreEqual_TestCodeFix ( string oldAssertion , string newAssertion )
364
363
=> VerifyCSharpFix ( "double actual, double expected, double delta" , oldAssertion , newAssertion ) ;
365
364
366
365
[ DataTestMethod ]
367
366
[ AssertionDiagnostic ( "Assert.AreEqual(expected, actual, delta{0});" ) ]
368
367
[ AssertionDiagnostic ( "Assert.AreEqual(expected, actual, 0.6f{0});" ) ]
368
+ [ AssertionDiagnostic ( "Assert.AreEqual(actual, 4.2f, 0.6f{0});" ) ]
369
+ [ AssertionDiagnostic ( "Assert.AreEqual(4.2f, actual, 0.6f{0});" ) ]
369
370
[ Implemented ]
370
371
public void AssertFloatAreEqual_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( "float actual, float expected, float delta" , assertion ) ;
371
372
@@ -376,35 +377,81 @@ public void AssertDoubleAreEqual_TestCodeFix(string oldAssertion, string newAsse
376
377
[ AssertionCodeFix (
377
378
oldAssertion : "Assert.AreEqual(expected, actual, 0.6f{0});" ,
378
379
newAssertion : "actual.Should().BeApproximately(expected, 0.6f{0});" ) ]
380
+ [ AssertionCodeFix (
381
+ oldAssertion : "Assert.AreEqual(actual, 4.2f, 0.6f{0});" ,
382
+ newAssertion : "actual.Should().BeApproximately(4.2f, 0.6f{0});" ) ]
383
+ [ AssertionCodeFix (
384
+ oldAssertion : "Assert.AreEqual(4.2f, actual, 0.6f{0});" ,
385
+ newAssertion : "actual.Should().BeApproximately(4.2f, 0.6f{0});" ) ]
379
386
[ Implemented ]
380
387
public void AssertFloatAreEqual_TestCodeFix ( string oldAssertion , string newAssertion )
381
388
=> VerifyCSharpFix ( "float actual, float expected, float delta" , oldAssertion , newAssertion ) ;
382
389
383
390
[ DataTestMethod ]
384
391
[ AssertionDiagnostic ( "Assert.AreEqual(expected, actual{0});" ) ]
392
+ [ AssertionDiagnostic ( "Assert.AreEqual(actual, \" literal\" {0});" ) ]
393
+ [ AssertionDiagnostic ( "Assert.AreEqual(\" literal\" , actual{0});" ) ]
385
394
[ AssertionDiagnostic ( "Assert.AreEqual(expected, actual, false{0});" ) ]
395
+ [ AssertionDiagnostic ( "Assert.AreEqual(actual, \" literal\" , false{0});" ) ]
396
+ [ AssertionDiagnostic ( "Assert.AreEqual(\" literal\" , actual, false{0});" ) ]
386
397
[ AssertionDiagnostic ( "Assert.AreEqual(expected, actual, true{0});" ) ]
398
+ [ AssertionDiagnostic ( "Assert.AreEqual(actual, \" literal\" , true{0});" ) ]
399
+ [ AssertionDiagnostic ( "Assert.AreEqual(\" literal\" , actual, true{0});" ) ]
387
400
[ AssertionDiagnostic ( "Assert.AreEqual(expected, actual, false, System.Globalization.CultureInfo.CurrentCulture{0});" ) ]
401
+ [ AssertionDiagnostic ( "Assert.AreEqual(actual, \" literal\" , false, System.Globalization.CultureInfo.CurrentCulture{0});" ) ]
402
+ [ AssertionDiagnostic ( "Assert.AreEqual(\" literal\" , actual, false, System.Globalization.CultureInfo.CurrentCulture{0});" ) ]
388
403
[ AssertionDiagnostic ( "Assert.AreEqual(expected, actual, true, System.Globalization.CultureInfo.CurrentCulture{0});" ) ]
404
+ [ AssertionDiagnostic ( "Assert.AreEqual(actual, \" literal\" , true, System.Globalization.CultureInfo.CurrentCulture{0});" ) ]
405
+ [ AssertionDiagnostic ( "Assert.AreEqual(\" literal\" , actual, true, System.Globalization.CultureInfo.CurrentCulture{0});" ) ]
389
406
[ Implemented ]
390
407
public void AssertStringAreEqual_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( "string actual, string expected" , assertion ) ;
391
408
392
409
[ DataTestMethod ]
393
410
[ AssertionCodeFix (
394
411
oldAssertion : "Assert.AreEqual(expected, actual{0});" ,
395
412
newAssertion : "actual.Should().Be(expected{0});" ) ]
413
+ [ AssertionCodeFix (
414
+ oldAssertion : "Assert.AreEqual(actual, \" literal\" {0});" ,
415
+ newAssertion : "actual.Should().Be(\" literal\" {0});" ) ]
416
+ [ AssertionCodeFix (
417
+ oldAssertion : "Assert.AreEqual(\" literal\" , actual{0});" ,
418
+ newAssertion : "actual.Should().Be(\" literal\" {0});" ) ]
396
419
[ AssertionCodeFix (
397
420
oldAssertion : "Assert.AreEqual(expected, actual, false{0});" ,
398
421
newAssertion : "actual.Should().Be(expected{0});" ) ]
422
+ [ AssertionCodeFix (
423
+ oldAssertion : "Assert.AreEqual(actual, \" literal\" , false{0});" ,
424
+ newAssertion : "actual.Should().Be(\" literal\" {0});" ) ]
425
+ [ AssertionCodeFix (
426
+ oldAssertion : "Assert.AreEqual(\" literal\" , actual, false{0});" ,
427
+ newAssertion : "actual.Should().Be(\" literal\" {0});" ) ]
399
428
[ AssertionCodeFix (
400
429
oldAssertion : "Assert.AreEqual(expected, actual, true{0});" ,
401
430
newAssertion : "actual.Should().BeEquivalentTo(expected{0});" ) ]
431
+ [ AssertionCodeFix (
432
+ oldAssertion : "Assert.AreEqual(actual, \" literal\" , true{0});" ,
433
+ newAssertion : "actual.Should().BeEquivalentTo(\" literal\" {0});" ) ]
434
+ [ AssertionCodeFix (
435
+ oldAssertion : "Assert.AreEqual(\" literal\" , actual, true{0});" ,
436
+ newAssertion : "actual.Should().BeEquivalentTo(\" literal\" {0});" ) ]
402
437
[ AssertionCodeFix (
403
438
oldAssertion : "Assert.AreEqual(expected, actual, false, System.Globalization.CultureInfo.CurrentCulture{0});" ,
404
439
newAssertion : "actual.Should().Be(expected{0});" ) ]
440
+ [ AssertionCodeFix (
441
+ oldAssertion : "Assert.AreEqual(actual, \" literal\" , false, System.Globalization.CultureInfo.CurrentCulture{0});" ,
442
+ newAssertion : "actual.Should().Be(\" literal\" {0});" ) ]
443
+ [ AssertionCodeFix (
444
+ oldAssertion : "Assert.AreEqual(\" literal\" , actual, false, System.Globalization.CultureInfo.CurrentCulture{0});" ,
445
+ newAssertion : "actual.Should().Be(\" literal\" {0});" ) ]
405
446
[ AssertionCodeFix (
406
447
oldAssertion : "Assert.AreEqual(expected, actual, true, System.Globalization.CultureInfo.CurrentCulture{0});" ,
407
448
newAssertion : "actual.Should().BeEquivalentTo(expected{0});" ) ]
449
+ [ AssertionCodeFix (
450
+ oldAssertion : "Assert.AreEqual(actual, \" literal\" , true, System.Globalization.CultureInfo.CurrentCulture{0});" ,
451
+ newAssertion : "actual.Should().BeEquivalentTo(\" literal\" {0});" ) ]
452
+ [ AssertionCodeFix (
453
+ oldAssertion : "Assert.AreEqual(\" literal\" , actual, true, System.Globalization.CultureInfo.CurrentCulture{0});" ,
454
+ newAssertion : "actual.Should().BeEquivalentTo(\" literal\" {0});" ) ]
408
455
[ Implemented ]
409
456
public void AssertStringAreEqual_TestCodeFix ( string oldAssertion , string newAssertion )
410
457
=> VerifyCSharpFix ( "string actual, string expected" , oldAssertion , newAssertion ) ;
@@ -455,20 +502,26 @@ public void AssertOptionalIntAreNotEqual_TestCodeFix(string oldAssertion, string
455
502
456
503
[ DataTestMethod ]
457
504
[ AssertionDiagnostic ( "Assert.AreNotEqual(actual, null{0});" ) ]
505
+ [ AssertionDiagnostic ( "Assert.AreNotEqual(null, actual{0});" ) ]
458
506
[ Implemented ]
459
507
public void AssertOptionalIntAndNullAreNotEqual_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( "int? actual" , assertion ) ;
460
508
461
509
[ DataTestMethod ]
462
510
[ AssertionCodeFix (
463
511
oldAssertion : "Assert.AreNotEqual(actual, null{0});" ,
464
512
newAssertion : "actual.Should().NotBeNull({0});" ) ]
513
+ [ AssertionCodeFix (
514
+ oldAssertion : "Assert.AreNotEqual(null, actual{0});" ,
515
+ newAssertion : "actual.Should().NotBeNull({0});" ) ]
465
516
[ Implemented ]
466
517
public void AssertOptionalIntAndNullAreNotEqual_TestCodeFix ( string oldAssertion , string newAssertion )
467
518
=> VerifyCSharpFix ( "int? actual" , oldAssertion , newAssertion ) ;
468
519
469
520
[ DataTestMethod ]
470
521
[ AssertionDiagnostic ( "Assert.AreNotEqual(expected, actual, delta{0});" ) ]
471
522
[ AssertionDiagnostic ( "Assert.AreNotEqual(expected, actual, 0.6f{0});" ) ]
523
+ [ AssertionDiagnostic ( "Assert.AreNotEqual(actual, 4.2f, 0.6f{0});" ) ]
524
+ [ AssertionDiagnostic ( "Assert.AreNotEqual(4.2f, actual, 0.6f{0});" ) ]
472
525
[ Implemented ]
473
526
public void AssertFloatAreNotEqual_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( "float actual, float expected, float delta" , assertion ) ;
474
527
@@ -479,6 +532,12 @@ public void AssertOptionalIntAndNullAreNotEqual_TestCodeFix(string oldAssertion,
479
532
[ AssertionCodeFix (
480
533
oldAssertion : "Assert.AreNotEqual(expected, actual, 0.6f{0});" ,
481
534
newAssertion : "actual.Should().NotBeApproximately(expected, 0.6f{0});" ) ]
535
+ [ AssertionCodeFix (
536
+ oldAssertion : "Assert.AreNotEqual(actual, 4.2f, 0.6f{0});" ,
537
+ newAssertion : "actual.Should().NotBeApproximately(4.2f, 0.6f{0});" ) ]
538
+ [ AssertionCodeFix (
539
+ oldAssertion : "Assert.AreNotEqual(4.2f, actual, 0.6f{0});" ,
540
+ newAssertion : "actual.Should().NotBeApproximately(4.2f, 0.6f{0});" ) ]
482
541
[ Implemented ]
483
542
public void AssertFloatAreNotEqual_TestCodeFix ( string oldAssertion , string newAssertion )
484
543
=> VerifyCSharpFix ( "float actual, float expected, float delta" , oldAssertion , newAssertion ) ;
0 commit comments