@@ -11,7 +11,7 @@ public class NumericTests
1111 [ AssertionDiagnostic ( "actual.Should().BeGreaterThan(0{0});" ) ]
1212 [ AssertionDiagnostic ( "actual.Should().BeGreaterThan(0{0}).ToString();" ) ]
1313 [ Implemented ]
14- public void NumericShouldBePositive_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < NumericShouldBePositiveAnalyzer > ( assertion ) ;
14+ public void NumericShouldBePositive_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( assertion , DiagnosticMetadata . NumericShouldBePositive_ShouldBeGreaterThan ) ;
1515
1616 [ DataTestMethod ]
1717 [ AssertionCodeFix (
@@ -21,13 +21,13 @@ public class NumericTests
2121 oldAssertion : "actual.Should().BeGreaterThan(0{0}).ToString();" ,
2222 newAssertion : "actual.Should().BePositive({0}).ToString();" ) ]
2323 [ Implemented ]
24- public void NumericShouldBePositive_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < NumericShouldBePositiveCodeFix , NumericShouldBePositiveAnalyzer > ( oldAssertion , newAssertion ) ;
24+ public void NumericShouldBePositive_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < FluentAssertionsCodeFix , FluentAssertionsOperationAnalyzer > ( oldAssertion , newAssertion ) ;
2525
2626 [ DataTestMethod ]
2727 [ AssertionDiagnostic ( "actual.Should().BeLessThan(0{0});" ) ]
2828 [ AssertionDiagnostic ( "actual.Should().BeLessThan(0{0}).ToString();" ) ]
2929 [ Implemented ]
30- public void NumericShouldBeNegative_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < NumericShouldBeNegativeAnalyzer > ( assertion ) ;
30+ public void NumericShouldBeNegative_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( assertion , DiagnosticMetadata . NumericShouldBeNegative_ShouldBeLessThan ) ;
3131
3232 [ DataTestMethod ]
3333 [ AssertionCodeFix (
@@ -37,17 +37,19 @@ public class NumericTests
3737 oldAssertion : "actual.Should().BeLessThan(0{0}).ToString();" ,
3838 newAssertion : "actual.Should().BeNegative({0}).ToString();" ) ]
3939 [ Implemented ]
40- public void NumericShouldBeNegative_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < NumericShouldBeNegativeCodeFix , NumericShouldBeNegativeAnalyzer > ( oldAssertion , newAssertion ) ;
40+ public void NumericShouldBeNegative_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < FluentAssertionsCodeFix , FluentAssertionsOperationAnalyzer > ( oldAssertion , newAssertion ) ;
4141
4242 [ DataTestMethod ]
4343 [ AssertionDiagnostic ( "actual.Should().BeGreaterOrEqualTo(lower{0}).And.BeLessOrEqualTo(upper);" ) ]
4444 [ AssertionDiagnostic ( "actual.Should().BeGreaterOrEqualTo(lower).And.BeLessOrEqualTo(upper{0});" ) ]
45- [ AssertionDiagnostic ( "actual.Should().BeGreaterOrEqualTo(lower{0}).And.BeLessOrEqualTo(upper{0});" ) ]
45+ [ Implemented ]
46+ public void NumericShouldBeInRange_BeGreaterOrEqualToAndBeLessOrEqualTo_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( assertion , DiagnosticMetadata . NumericShouldBeInRange_BeGreaterOrEqualToAndBeLessOrEqualTo ) ;
47+
48+ [ DataTestMethod ]
4649 [ AssertionDiagnostic ( "actual.Should().BeLessOrEqualTo(upper{0}).And.BeGreaterOrEqualTo(lower);" ) ]
4750 [ AssertionDiagnostic ( "actual.Should().BeLessOrEqualTo(upper).And.BeGreaterOrEqualTo(lower{0});" ) ]
48- [ AssertionDiagnostic ( "actual.Should().BeLessOrEqualTo(upper{0}).And.BeGreaterOrEqualTo(lower{0});" ) ]
4951 [ Implemented ]
50- public void NumericShouldBeInRange_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < NumericShouldBeInRangeAnalyzer > ( assertion ) ;
52+ public void NumericShouldBeInRange_BeLessOrEqualToAndBeGreaterOrEqualTo_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( assertion , DiagnosticMetadata . NumericShouldBeInRange_BeLessOrEqualToAndBeGreaterOrEqualTo ) ;
5153
5254 [ DataTestMethod ]
5355 [ AssertionCodeFix (
@@ -62,33 +64,30 @@ public class NumericTests
6264 [ AssertionCodeFix (
6365 oldAssertion : "actual.Should().BeLessOrEqualTo(upper).And.BeGreaterOrEqualTo(lower{0});" ,
6466 newAssertion : "actual.Should().BeInRange(lower, upper{0});" ) ]
65- [ Implemented ]
66- public void NumericShouldBeInRange_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < NumericShouldBeInRangeCodeFix , NumericShouldBeInRangeAnalyzer > ( oldAssertion , newAssertion ) ;
67+ [ NotImplemented ]
68+ public void NumericShouldBeInRange_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < FluentAssertionsCodeFix , FluentAssertionsOperationAnalyzer > ( oldAssertion , newAssertion ) ;
6769
6870 [ DataTestMethod ]
6971 [ AssertionDiagnostic ( "Math.Abs(expected - actual).Should().BeLessOrEqualTo(delta{0});" ) ]
7072 [ Implemented ]
71- public void NumericShouldBeApproximately_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic < NumericShouldBeApproximatelyAnalyzer > ( assertion ) ;
73+ public void NumericShouldBeApproximately_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnostic ( assertion , DiagnosticMetadata . NumericShouldBeApproximately_MathAbsShouldBeLessOrEqualTo ) ;
7274
7375 [ DataTestMethod ]
7476 [ AssertionCodeFix (
7577 oldAssertion : "Math.Abs(expected - actual).Should().BeLessOrEqualTo(delta{0});" ,
7678 newAssertion : "actual.Should().BeApproximately(expected, delta{0});" ) ]
7779 [ Implemented ]
78- public void NumericShouldBeApproximately_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < NumericShouldBeApproximatelyCodeFix , NumericShouldBeApproximatelyAnalyzer > ( oldAssertion , newAssertion ) ;
80+ public void NumericShouldBeApproximately_TestCodeFix ( string oldAssertion , string newAssertion ) => VerifyCSharpFix < FluentAssertionsCodeFix , FluentAssertionsOperationAnalyzer > ( oldAssertion , newAssertion ) ;
7981
80- private void VerifyCSharpDiagnostic < TDiagnosticAnalyzer > ( string sourceAssertion ) where TDiagnosticAnalyzer : Microsoft . CodeAnalysis . Diagnostics . DiagnosticAnalyzer , new ( )
82+ private void VerifyCSharpDiagnostic ( string sourceAssertion , DiagnosticMetadata metadata )
8183 {
8284 var source = GenerateCode . DoubleAssertion ( sourceAssertion ) ;
8385
84- var type = typeof ( TDiagnosticAnalyzer ) ;
85- var diagnosticId = ( string ) type . GetField ( "DiagnosticId" ) . GetValue ( null ) ;
86- var message = ( string ) type . GetField ( "Message" ) . GetValue ( null ) ;
87-
8886 DiagnosticVerifier . VerifyCSharpDiagnosticUsingAllAnalyzers ( source , new DiagnosticResult
8987 {
90- Id = diagnosticId ,
91- Message = message ,
88+ Id = FluentAssertionsOperationAnalyzer . DiagnosticId ,
89+ Message = metadata . Message ,
90+ VisitorName = metadata . Name ,
9291 Locations = new DiagnosticResultLocation [ ]
9392 {
9493 new DiagnosticResultLocation ( "Test0.cs" , 10 , 13 )
0 commit comments