@@ -320,6 +320,13 @@ public class CollectionTests
320
320
[ Implemented ]
321
321
public void CollectionShouldHaveCount_LengthShouldBe_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnosticCodeBlock ( assertion , DiagnosticMetadata . CollectionShouldHaveCount_LengthShouldBe ) ;
322
322
323
+ [ DataTestMethod ]
324
+ [ AssertionDiagnostic ( "actual.Should().HaveCount(expected.Count() + 1{0});" ) ]
325
+ [ AssertionDiagnostic ( "actual.Should().HaveCount(expected.Count() + unexpected.Count(){0});" ) ]
326
+ [ AssertionDiagnostic ( "actual.Should().HaveCount(expected.Count + unexpected.Count{0});" ) ]
327
+ [ Implemented ( Reason = "https://github.com/fluentassertions/fluentassertions.analyzers/issues/300" ) ]
328
+ public void CollectionShouldHaveCount_TestNoAnalyzer ( string assertion ) => DiagnosticVerifier . VerifyCSharpDiagnosticUsingAllAnalyzers ( GenerateCode . GenericIListCodeBlockAssertion ( assertion ) ) ;
329
+
323
330
[ DataTestMethod ]
324
331
[ AssertionCodeFix (
325
332
oldAssertion : "actual.Count().Should().Be(k{0});" ,
@@ -533,6 +540,13 @@ public class CollectionTests
533
540
[ Implemented ]
534
541
public void CollectionShouldHaveSameCount_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnosticCodeBlock ( assertion , DiagnosticMetadata . CollectionShouldHaveSameCount_ShouldHaveCountOtherCollectionCount ) ;
535
542
543
+ [ DataTestMethod ]
544
+ [ AssertionDiagnostic ( "actual.Should().HaveCount(expected.Count() + 1{0});" ) ]
545
+ [ AssertionDiagnostic ( "actual.Should().HaveCount(expected.Count() + unexpected.Count(){0});" ) ]
546
+ [ AssertionDiagnostic ( "actual.Should().HaveCount(1 + expected.Count(){0});" ) ]
547
+ [ Implemented ( Reason = "https://github.com/fluentassertions/fluentassertions.analyzers/issues/300" ) ]
548
+ public void CollectionShouldHaveSameCount_TestNoAnalyzer ( string assertion ) => DiagnosticVerifier . VerifyCSharpDiagnosticUsingAllAnalyzers ( GenerateCode . GenericIListCodeBlockAssertion ( assertion ) ) ;
549
+
536
550
[ DataTestMethod ]
537
551
[ AssertionCodeFix (
538
552
oldAssertion : "actual.Should().HaveCount(expected.Count(){0});" ,
@@ -903,6 +917,11 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR
903
917
[ Implemented ]
904
918
public void CollectionShouldOnlyHaveUniqueItems_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnosticCodeBlock ( assertion , DiagnosticMetadata . CollectionShouldOnlyHaveUniqueItems_ShouldHaveSameCountThisCollectionDistinct ) ;
905
919
920
+ [ DataTestMethod ]
921
+ [ AssertionDiagnostic ( "actual.Should().HaveSameCount(expected.Distinct(){0});" ) ]
922
+ [ Implemented ( Reason = "https://github.com/fluentassertions/fluentassertions.analyzers/issues/299" ) ]
923
+ public void CollectionShouldOnlyHaveUniqueItems_TestNoAnalyzer ( string assertion ) => DiagnosticVerifier . VerifyCSharpDiagnosticUsingAllAnalyzers ( GenerateCode . GenericIListCodeBlockAssertion ( assertion ) ) ;
924
+
906
925
[ DataTestMethod ]
907
926
[ AssertionCodeFix (
908
927
oldAssertion : "actual.Should().HaveSameCount(actual.Distinct(){0});" ,
@@ -1032,7 +1051,7 @@ private void VerifyCSharpFixExpressionBody(string oldSourceAssertion, string new
1032
1051
{
1033
1052
var oldSource = GenerateCode . GenericIListExpressionBodyAssertion ( oldSourceAssertion ) ;
1034
1053
var newSource = GenerateCode . GenericIListExpressionBodyAssertion ( newSourceAssertion ) ;
1035
-
1054
+
1036
1055
VerifyFix ( oldSource , newSource ) ;
1037
1056
}
1038
1057
0 commit comments