Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Make new CloneDefaults less assuming - #1460

#1460
Merged
jnyrup merged 1 commit into
fluentassertions:developfluentassertions/fluentassertions:developfrom
jnyrup:CloneDefaultsjnyrup/fluentassertions:CloneDefaultsCopy head branch name to clipboard
Jan 9, 2021
Merged

Make new CloneDefaults less assuming#1460
jnyrup merged 1 commit into
fluentassertions:developfluentassertions/fluentassertions:developfrom
jnyrup:CloneDefaultsjnyrup/fluentassertions:CloneDefaultsCopy head branch name to clipboard

Conversation

@jnyrup

@jnyrup jnyrup commented Jan 9, 2021

Copy link
Copy Markdown
Member

The new CloneDefaults added in #1419 assumes that TOptions has a constructor that takes an EquivalencyAssertionOptions.
Instead of assuming the existence of such a constructor, inject a predicate to make it more type safe.

Two other benefits:

  • The compiler now easily sees that DataEquivalencyAssertionOptions is constructed.
  • It's faster to construct and inject a predicate.
|            Method |       Mean |    Error |   StdDev | Ratio |  Gen 0 |  Gen 1 | Gen 2 | Allocated |
|------------------ |-----------:|---------:|---------:|------:|-------:|-------:|------:|----------:|
|     CloneDefaults | 1,437.0 ns | 27.29 ns | 29.20 ns |  1.00 | 0.4349 | 0.0038 |     - |   2.68 KB |
| CloneDefaultsFunc |   708.4 ns |  5.20 ns |  4.86 ns |  0.49 | 0.3729 | 0.0038 |     - |    2.3 KB |

Comment thread Src/FluentAssertions/AssertionOptions.cs Outdated
@jnyrup
jnyrup merged commit a8fce5d into fluentassertions:develop Jan 9, 2021
@jnyrup
jnyrup deleted the CloneDefaults branch January 9, 2021 20:45
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.