Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/FluentAssertions.Analyzers.Tests/Tips/CollectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,12 @@ public void CollectionShouldHaveCount_LengthShouldBe_TestNoAnalyzer(string asser
[Implemented]
public void CollectionShouldHaveCountLessOrEqualTo_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion, DiagnosticMetadata.CollectionShouldHaveCountLessOrEqualTo_CountShouldBeLessOrEqualTo);

[DataTestMethod]
[AssertionDiagnostic("(actual.Count() + 1).Should().BeLessOrEqualTo(k{0});")]
[AssertionDiagnostic("(actual.Count() + 1).Should().BeLessOrEqualTo(6{0});")]
[Implemented]
public void CollectionShouldHaveCountLessOrEqualTo_TestNoAnalyzer(string assertion) => DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(GenerateCode.GenericIListCodeBlockAssertion(assertion));

[DataTestMethod]
[AssertionCodeFix(
oldAssertion: "actual.Count().Should().BeLessOrEqualTo(k{0});",
Expand Down
5 changes: 5 additions & 0 deletions src/FluentAssertions.Analyzers.Tests/Tips/NumericTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ void verifyNoDiagnostic(string type)
[Implemented]
public void NumericShouldBeApproximately_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion, DiagnosticMetadata.NumericShouldBeApproximately_MathAbsShouldBeLessOrEqualTo);

[DataTestMethod]
[AssertionDiagnostic("(Math.Abs(expected - actual) + 1).Should().BeLessOrEqualTo(delta{0});")]
[Implemented]
public void NumericShouldBeApproximately_TestNoAnalyzer(string assertion) => DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(GenerateCode.NumericAssertion(assertion, "double"));

[DataTestMethod]
[AssertionCodeFix(
oldAssertion: "Math.Abs(expected - actual).Should().BeLessOrEqualTo(delta{0});",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ private static void AnalyzeInvocation(OperationAnalysisContext context, FluentAs
return;
case "BeLessOrEqualTo" when assertion.IsContainedInType(metadata.NumericAssertionsOfT2):
{
if (invocation.TryGetFirstDescendent<IInvocationOperation>(out var invocationBeforeShould))
if (invocation.TryGetSingleArgumentAs<IInvocationOperation>(out var invocationBeforeShould))
{
switch (invocationBeforeShould.TargetMethod.Name)
{
Expand Down
Loading