-
Notifications
You must be signed in to change notification settings - Fork 729
Introduced a new attribute to allow global initialization of the assertion options #2292
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
Introduced a new attribute to allow global initialization of the assertion options #2292
Conversation
40173e5
to
6192a96
Compare
This comment was marked as outdated.
This comment was marked as outdated.
0e24df3
to
1e9b078
Compare
1e9b078
to
7dc23f8
Compare
7dc23f8
to
3e0e13d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, it looks good. I think explaining what the effect is of 'using multiple times', v.s. 'called once' might be explained in more detail.
Good point. Will look a the description. Need to rebase anyway. |
3e0e13d
to
b5a3c2c
Compare
51f8e09
to
e533255
Compare
Qodana for .NETIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked View the detailed Qodana reportTo be able to view the detailed Qodana report, you can either:
To get - name: 'Qodana Scan'
uses: JetBrains/[email protected]
with:
upload-result: true Contact Qodana teamContact us at [email protected]
|
Pull Request Test Coverage Report for Build 6652964260
💛 - Coveralls |
Tests/FluentAssertions.Extensibility.Specs/FluentAssertions.Extensibility.Specs.csproj
Outdated
Show resolved
Hide resolved
bc727d5
to
c4aec36
Compare
This PR introduces FA's own "module initializer" through the new
[AssertionEngineInitializer]
attribute. It can be used multiple times.For future reference, we're not using
ModuleInitializerAttribute
for two reasons:FluentAssertions.DataSets
may not even get a chance to register its custom implementations ofIEquivalencyStep
when somebody invokesBeEquivalentTo
without explicitly using code from that package first. To resolve this, you could have that package add a source file as content (in NuGet terms) that adds a module initializer. Then it would be invoked the first time the test project is loaded. But that would require that source file to define theModuleInitializerAttribute
for .NET 4.x, which is hard since you can't detect whether it is needed. non-SDK projects do not define attributes like NETFRAMEWORK and such. If that test project already defines that attribute in a different way (e.g. using Polysharp), it would cause compilation conflicts.Also, while testing with
FluentAssertions.DataSets
, it turns out the caller identifier was misbehaving if Fluent Assertions code preceded the data set extensions code in the stack trace. This has been fixed as well.Tested with the FluentAssertions.DataSets repository.
Note Review by commit
Closes #2290