File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
FluentAssertions.Analyzers.Tests/Tips
FluentAssertions.Analyzers/Tips Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,19 @@ namespace FluentAssertions.Analyzers.Tests.Tips
88 [ TestClass ]
99 public class MsTestTests
1010 {
11+ [ DataTestMethod ]
12+ [ AssertionDiagnostic ( "Assert.Inconclusive({0});" ) ]
13+ [ AssertionDiagnostic ( "Assert.Fail({0});" ) ]
14+ [ Implemented ]
15+ public void MsTest_NotReportedAsserts_TestAnalyzer ( string assertion )
16+ {
17+ DiagnosticVerifier . VerifyDiagnostic ( new DiagnosticVerifierArguments ( )
18+ . WithAllAnalyzers ( )
19+ . WithSources ( GenerateCode . MsTestAssertion ( string . Empty , assertion ) )
20+ . WithPackageReferences ( PackageReference . FluentAssertions_6_12_0 , PackageReference . MSTestTestFramework_3_1_1 )
21+ ) ;
22+ }
23+
1124 [ DataTestMethod ]
1225 [ AssertionDiagnostic ( "Assert.IsTrue(actual{0});" ) ]
1326 [ AssertionDiagnostic ( "Assert.IsTrue(bool.Parse(\" true\" ){0});" ) ]
Original file line number Diff line number Diff line change @@ -162,6 +162,8 @@ public void AnalyzeMsTestInvocation(OperationAnalysisContext context)
162162 var op = ( IInvocationOperation ) context . Operation ;
163163 if ( IsMsTestAssertClass ( op . TargetMethod . ContainingType ) && ! IsMethodExcluded ( context . Options , op ) )
164164 {
165+ if ( op . TargetMethod . Name is "Fail" or "Inconclusive" && op . TargetMethod . ContainingType . EqualsSymbol ( _msTestsAssertSymbol ) )
166+ return ;
165167 context . ReportDiagnostic ( Diagnostic . Create ( MSTestsRule , op . Syntax . GetLocation ( ) ) ) ;
166168 }
167169 }
You can’t perform that action at this time.
0 commit comments