Skip to content

Conversation

@anthony-c-martin
Copy link
Contributor

Discussed here - I thought I'd contribute a potential solution.

My personal use case is that I've got some costly calculations to display user-friendly failure info, and I'd like to avoid doing this for the 99% case where the tests run successfully.

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.

Copy link
Member

@dennisdoomen dennisdoomen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be willing to add the corresponding release note changes and possibly some docs as explained in the Pull Request template?

@anthony-c-martin
Copy link
Contributor Author

anthony-c-martin commented Apr 3, 2021

Would you be willing to add the corresponding release note changes and possibly some docs as explained in the Pull Request template?

Absolutely! I've added to the release notes for 6.0.0. Please let me know if I missed anything there.

I don't see any reference to the existing AddReportable function in the current docs but can certainly take a stab at adding it in.

@dennisdoomen dennisdoomen requested a review from jnyrup April 3, 2021 15:13

private sealed class DeferredReportable
{
private readonly Lazy<string> lazyValue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a known case where valueFunc is invoked more than once?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're only calling ContextDateItems.GetReportable when the scope is disposed, and only if it's the outer scope, so I think we're fine.

@dennisdoomen
Copy link
Member

You need to update the approval files.

@dennisdoomen dennisdoomen merged commit da9f260 into fluentassertions:develop Apr 5, 2021
@dennisdoomen
Copy link
Member

Thank you for your contribution.

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.

3 participants