From a0e5050ad479f03fa36a94c34780a75f1311b9ce Mon Sep 17 00:00:00 2001 From: Meir Blachman Date: Tue, 22 Aug 2023 19:33:05 +0300 Subject: [PATCH] reproduce tests case --- .../Tips/CollectionTests.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/FluentAssertions.Analyzers.Tests/Tips/CollectionTests.cs b/src/FluentAssertions.Analyzers.Tests/Tips/CollectionTests.cs index c928f378..de98ff5e 100644 --- a/src/FluentAssertions.Analyzers.Tests/Tips/CollectionTests.cs +++ b/src/FluentAssertions.Analyzers.Tests/Tips/CollectionTests.cs @@ -396,6 +396,10 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [AssertionDiagnostic("actual.Where(x => x.BooleanProperty).Should().HaveCount(1{0});")] [AssertionDiagnostic("actual.AsEnumerable().Should().HaveCount(1{0}).And.ToString();")] [AssertionDiagnostic("actual.AsEnumerable().Where(x => x.BooleanProperty).Should().HaveCount(1{0}).And.ToString();")] + [AssertionDiagnostic("actual.Should().HaveCount(1{0}).And.Contain(item => item == expectedItem);")] + [AssertionDiagnostic("actual.Where(x => x.BooleanProperty).Should().HaveCount(1{0}).And.Contain(item => item == expectedItem);")] + [AssertionDiagnostic("actual.AsEnumerable().Should().HaveCount(1{0}).And.Contain(item => item == expectedItem).And.ToString();")] + [AssertionDiagnostic("actual.AsEnumerable().Where(x => x.BooleanProperty).Should().HaveCount(1{0}).And.Contain(item => item == expectedItem).And.ToString();")] [Implemented] public void CollectionShouldContainSingle_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); @@ -412,6 +416,12 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [AssertionCodeFix( oldAssertion: "actual.AsEnumerable().Should().HaveCount(1{0}).And.ToString();", newAssertion: "actual.AsEnumerable().Should().ContainSingle({0}).And.ToString();")] + [AssertionCodeFix( + oldAssertion: "actual.Should().HaveCount(1{0}).And.Contain(item => item == expectedItem);", + newAssertion: "actual.Should().ContainSingle({0}).Which.Should().Be(expectedItem);")] + [AssertionCodeFix( + oldAssertion: "actual.AsEnumerable().Should().HaveCount(1{0}).And.Contain(item => item == expectedItem).And.ToString();", + newAssertion: "actual.AsEnumerable().Should().ContainSingle({0}).Which.Should().Be(expectedItem).And.ToString();")] [Implemented] public void CollectionShouldContainSingle_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion);