@@ -318,9 +318,30 @@ public class CollectionTests
318318 public void CollectionShouldHaveCount_CountShouldBe1_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnosticCodeBlock ( assertion , DiagnosticMetadata . CollectionShouldContainSingle_CountShouldBe1 ) ;
319319
320320 [ DataTestMethod ]
321- [ AssertionDiagnostic ( "actual.ToArray().Length.Should().Be(1{0}).And.ToString();" ) ]
322- [ Implemented ]
323- public void CollectionShouldHaveCount_LengthShouldBe_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnosticCodeBlock ( assertion , DiagnosticMetadata . CollectionShouldHaveCount_LengthShouldBe ) ;
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();" ) ]
327+ [ Implemented ]
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});" ) ]
@@ -610,6 +631,12 @@ public void CollectionShouldHaveCount_LengthShouldBe_TestNoAnalyzer(string asser
610631 [ Implemented ]
611632 public void CollectionShouldNotHaveSameCount_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnosticCodeBlock ( assertion , DiagnosticMetadata . CollectionShouldNotHaveSameCount_CountShouldNotBeOtherCollectionCount ) ;
612633
634+ [ DataTestMethod ]
635+ [ AssertionDiagnostic ( "(actual.Count() + 1).Should().NotBe(unexpected.Count(){0});" ) ]
636+ [ AssertionDiagnostic ( "actual.Count().ToString().Length.Should().NotBe(unexpected.Count(){0});" ) ]
637+ [ Implemented ]
638+ public void CollectionShouldNotHaveSameCount_TestNotAnalyzer ( string assertion ) => DiagnosticVerifier . VerifyCSharpDiagnosticUsingAllAnalyzers ( GenerateCode . GenericIListCodeBlockAssertion ( assertion ) ) ;
639+
613640 [ DataTestMethod ]
614641 [ AssertionCodeFix (
615642 oldAssertion : "actual.Count().Should().NotBe(unexpected.Count(){0});" ,
@@ -742,6 +769,14 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR
742769 [ Implemented ]
743770 public void CollectionShouldHaveElementAt_ElementAtIndexShouldBe_TestAnalyzer ( string assertion ) => VerifyCSharpDiagnosticCodeBlock ( assertion , DiagnosticMetadata . CollectionShouldHaveElementAt_ElementAtIndexShouldBe ) ;
744771
772+ [ DataTestMethod ]
773+ [ AssertionDiagnostic ( "actual.ElementAt(k).BooleanProperty.Should().Be(expectedItem.BooleanProperty{0});" ) ]
774+ [ AssertionDiagnostic ( "actual.ElementAt(6).BooleanProperty.Should().Be(expectedItem.BooleanProperty{0});" ) ]
775+ [ AssertionDiagnostic ( "actual.AsEnumerable().ElementAt(k).BooleanProperty.Should().Be(expectedItem.BooleanProperty{0}).And.ToString();" ) ]
776+ [ AssertionDiagnostic ( "actual.AsEnumerable().ElementAt(6).BooleanProperty.Should().Be(expectedItem.BooleanProperty{0}).And.ToString();" ) ]
777+ [ Implemented ]
778+ public void CollectionShouldHaveElementAt_ElementAtIndexShouldBe_TestNoAnalyzer ( string assertion ) => DiagnosticVerifier . VerifyCSharpDiagnosticUsingAllAnalyzers ( GenerateCode . GenericIListCodeBlockAssertion ( assertion ) ) ;
779+
745780 [ DataTestMethod ]
746781 [ AssertionDiagnostic ( "actual[k].Should().Be(expectedItem{0});" ) ]
747782 [ AssertionDiagnostic ( "actual[6].Should().Be(expectedItem{0});" ) ]
0 commit comments