Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting a lambda expression containing an extension method #1696

Conversation

vanya-lebedev
Copy link
Contributor

@vanya-lebedev vanya-lebedev commented Oct 2, 2021

Problem

Calling an extension method from the expression provided to Satisfy causes an exception. Solves #1688

Solution

Ignore null expressions in the constant visitor.

Not in scope

User-friendly formatting of an external lambda expression parameter is not solved as part of this pull request. I can see that it is also not yet cleanly solved in other APIs.
E.g. Should().Contain(a => allowed.Contains(a)) would fail with the following error message:

"Expected actual {4} to have an item matching value(FluentAssertions.Specs.Formatting.PredicateLambdaExpressionValueFormatterSpecs+<>c__DisplayClass5_0).allowed.Contains(i).";

IMPORTANT

  • The code complies with the Coding Guidelines for C#.
  • The changes are covered by a new or existing set of unit tests which follow the Arrange-Act-Assert syntax such as is used in this example.
  • If the contribution adds a feature or fixes a bug, please update the release notes, which are published on the website.
  • If the contribution changes the public API the changes needs to be included by running AcceptApiChanges.ps1/AcceptApiChanges.sh.
  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.

@vanya-lebedev
Copy link
Contributor Author

hmm... can't figure out how to link this PR to the issue. The linked issues section is disabled for me....

image

@jnyrup jnyrup linked an issue Oct 3, 2021 that may be closed by this pull request
docs/_pages/releases.md Outdated Show resolved Hide resolved
@dennisdoomen
Copy link
Member

hmm... can't figure out how to link this PR to the issue. The linked issues section is disabled for me....

Normally you just add a phrase like closes #1234

Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>
@jnyrup jnyrup merged commit 8b9c428 into fluentassertions:master Oct 3, 2021
@jnyrup jnyrup changed the title Satisfy doesn't support extension methods #1688 Fix formatting a lambda expression containing an extension method Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Satisfy doesn't support extension methods
3 participants