@@ -316,11 +316,32 @@ public class CollectionTests
316316 [ AssertionDiagnostic ( "actual.ToArray().Count().Should().Be(1{0}).And.ToString();" ) ]
317317 [ Implemented ]
318318 public void CollectionShouldHaveCount_CountShouldBe1_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnosticCodeBlock ( assertion , DiagnosticMetadata . CollectionShouldContainSingle_CountShouldBe1 ) ;
319-
319+
320320 [ DataTestMethod ]
321- [ AssertionDiagnostic ( "actual.ToArray().Length.Should().Be(1{0}).And.ToString();" ) ]
321+ [ AssertionDiagnostic ( "(array.Count() + 1).Should().Be(0{0}).And.ToString();" ) ]
322+ [ AssertionDiagnostic ( "(array.Count() + 1).Should().Be(1{0}).And.ToString();" ) ]
323+ [ AssertionDiagnostic ( "(array.Count() + 1).Should().Be(expectedSize{0}).And.ToString();" ) ]
324+ [ AssertionDiagnostic ( "(list.Count + 1).Should().Be(0{0}).And.ToString();" ) ]
325+ [ AssertionDiagnostic ( "(list.Count + 1).Should().Be(1{0}).And.ToString();" ) ]
326+ [ AssertionDiagnostic ( "(list.Count + 1).Should().Be(expectedSize{0}).And.ToString();" ) ]
322327 [ Implemented ]
323- public void CollectionShouldHaveCount_LengthShouldBe_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnosticCodeBlock ( assertion , DiagnosticMetadata . CollectionShouldHaveCount_LengthShouldBe ) ;
328+ public void CollectionShouldHaveCount_CountShouldBe_TestNoAnalyzer ( string assertion ) => DiagnosticVerifier . VerifyCSharpDiagnosticUsingAllAnalyzers ( new StringBuilder ( )
329+ . AppendLine ( "using System;" )
330+ . AppendLine ( "using System.Collections.Generic;" )
331+ . AppendLine ( "using System.Linq;" )
332+ . AppendLine ( "using FluentAssertions;" )
333+ . AppendLine ( "using FluentAssertions.Extensions;" )
334+ . AppendLine ( "namespace TestNamespace" )
335+ . AppendLine ( "{" )
336+ . AppendLine ( " public class TestClass" )
337+ . AppendLine ( " {" )
338+ . AppendLine ( " public void TestMethod(string[] array, List<string> list, int expectedSize)" )
339+ . AppendLine ( " {" )
340+ . AppendLine ( assertion )
341+ . AppendLine ( " }" )
342+ . AppendLine ( " }" )
343+ . AppendLine ( "}" )
344+ . ToString ( ) ) ;
324345
325346 [ DataTestMethod ]
326347 [ AssertionDiagnostic ( @"var array = new string[0, 0]; array.Length.Should().Be(0{0});" ) ]
@@ -330,6 +351,7 @@ public class CollectionTests
330351 [ AssertionDiagnostic ( @"var array = new string[2, 2]; array.Length.Should().Be(0{0});" ) ]
331352 [ AssertionDiagnostic ( @"var array = new string[3, 3, 3]; array.Length.Should().Be(0{0});" ) ]
332353 [ AssertionDiagnostic ( @"int[] array1 = [1, 2, 3]; int[] array2 = [4, 5, 6]; int[] both = [..array1, ..array2]; (array1.Length + array2.Length).Should().Be(both.Length{0});" ) ]
354+ [ AssertionDiagnostic ( "(actual.Count() + 1).Should().Be(1{0}).And.ToString();" ) ]
333355 [ Implemented ( Reason = "https://github.com/fluentassertions/fluentassertions.analyzers/issues/309" ) ]
334356 public void CollectionShouldHaveCount_LengthShouldBe_TestNoAnalyzer ( string assertion ) => DiagnosticVerifier . VerifyCSharpDiagnosticUsingAllAnalyzers ( new StringBuilder ( )
335357 . AppendLine ( "using System;" )
0 commit comments