Skip to content

Conversation

@cbersch
Copy link
Member

@cbersch cbersch commented Mar 9, 2025

Fixes #48

IMPORTANT

  • If the PR touches the public API, the changes have been approved in a separate issue with the "api-approved" label.
  • The code complies with the Coding Guidelines for C#.
  • The changes are covered by unit tests which follow the Arrange-Act-Assert syntax and the naming conventions such as is used in these tests.
  • If the PR adds a feature or fixes a bug, please update the release notes with a functional description that explains what the change means to consumers of this library, which are published on the website.
  • If the PR changes the public API the changes needs to be included by running AcceptApiChanges.ps1 or AcceptApiChanges.sh.
  • If the PR affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
    • Please also run ./build.sh --target spellcheck or .\build.ps1 --target spellcheck before pushing and check the good outcome

@coveralls
Copy link

coveralls commented Mar 9, 2025

Pull Request Test Coverage Report for Build 14128706657

Details

  • 325 of 326 (99.69%) changed or added relevant lines in 21 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 97.448%

Changes Missing Coverage Covered Lines Changed/Added Lines %
Src/FluentAssertions/Types/TypeAssertions.cs 104 105 99.05%
Totals Coverage Status
Change from base Build 14062683372: 0.02%
Covered Lines: 12430
Relevant Lines: 12614

💛 - Coveralls

@cbersch cbersch force-pushed the typevalueformatter branch 3 times, most recently from 90d53ca to 09e24b5 Compare March 14, 2025 14:35
@cbersch cbersch self-assigned this Mar 14, 2025
@cbersch cbersch force-pushed the typevalueformatter branch 2 times, most recently from 7613b23 to c74233e Compare March 16, 2025 11:04
@cbersch cbersch marked this pull request as ready for review March 16, 2025 11:05
@cbersch cbersch requested a review from a team March 16, 2025 11:05
Copy link
Contributor

@ITaluone ITaluone left a comment

Choose a reason for hiding this comment

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

Great work!

Just a few comments for you to consider..

Copy link
Member

@IT-VBFK IT-VBFK left a comment

Choose a reason for hiding this comment

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

LGTM

The most failures look way cleaner and way more readable than before.

Maybe the suggestions from @msmolka can be a refinement in a follow-up PR...

@cbersch
Copy link
Member Author

cbersch commented Mar 28, 2025

The most failures look way cleaner and way more readable than before.

Maybe the suggestions from @msmolka can be a refinement in a follow-up PR...

I've been busy lately.
I'm currently revising some changes and introducing a wrapper for formatting a type without any namespaces. (Only a marker class ShortTypeValue(Type type) which indicates that no namespaces should be formatted).

Then we have the variants

  • All namespaces everywhere: System.Collections.Generic.List<System.ThreadingTasks.Task>
  • Type definition with namespaces: System.Collections.Generic.List<T>
  • All generic types without namespaces: List<Task>
  • Type definition without namespaces: List<T>.

@cbersch cbersch force-pushed the typevalueformatter branch from fc8f0e8 to 5ec660d Compare March 28, 2025 12:15
@sonarqubecloud
Copy link

@cbersch
Copy link
Member Author

cbersch commented Mar 28, 2025

@IT-VBFK I reverted some changes were previously there was Type.Name. And I had to make some formatting consistent, like the type formatting when asserting method/constructor/property/indexer.
Hopefully I'm done now

@cbersch cbersch requested a review from IT-VBFK March 28, 2025 12:17
Copy link
Member

@IT-VBFK IT-VBFK left a comment

Choose a reason for hiding this comment

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

Quite cool :)

@cbersch cbersch merged commit ead381f into AwesomeAssertions:main Mar 28, 2025
7 checks passed
@msmolka
Copy link

msmolka commented Mar 28, 2025

Thanks, I agree with the changes, looks good

@ScarletKuro
Copy link
Contributor

ScarletKuro commented Mar 29, 2025

Just a quick question to make sure I'm not missing anything. Is this, low-key, a breaking change that will force people to remove typeof(XYZ).FullName if they’ve been using it with WithExpectation / FailWith?

If so, I think it would be a good idea to add a feature flag to disable it, like this:

<!-- End develop adds to opt in for old behavior -->
<ItemGroup>
  <RuntimeHostConfigurationOption Include="AwesomeAssertions.TypeValueFormatter" Value="false" />
</ItemGroup>

Then, in the AA code, should check:

AppContext.TryGetSwitch("AwesomeAssertions.TypeValueFormatter", out var enabled);

Whether this should be opt-in or opt-out is another question.

Just a side note: MSFT has switched to AA and is using v8, so we want to avoid causing any issues.

@cbersch
Copy link
Member Author

cbersch commented Mar 29, 2025

Just a quick question to make sure I'm not missing anything. Is this, low-key, a breaking change that will force people to remove typeof(XYZ).FullName if they’ve been using it with WithExpectation / FailWith?

No change in user code is required.

The change affects only the error message if one uses FailWith("type {0}", typeof(xyz)).

In previous versions changes of error messages haven't been seen as being breaking.

@cbersch cbersch deleted the typevalueformatter branch April 2, 2025 08:56
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.

[Feature]: Improve formatting of Type

6 participants