Simplify inheritance of `SubsequentOrderingAssertions` by vbreuss · Pull Request #2439 · fluentassertions/fluentassertions · GitHub
Skip to content

Simplify inheritance of SubsequentOrderingAssertions#2439

Merged
dennisdoomen merged 3 commits into
fluentassertions:developfrom
vbreuss:topic/fix-inheritance
Oct 26, 2024
Merged

Simplify inheritance of SubsequentOrderingAssertions#2439
dennisdoomen merged 3 commits into
fluentassertions:developfrom
vbreuss:topic/fix-inheritance

Conversation

@vbreuss

@vbreuss vbreuss commented Nov 5, 2023

Copy link
Copy Markdown
Contributor

The SubsequentOrderingGenericCollectionAssertions<TCollection, T> is only used as a base class for SubsequentOrderingAssertions. By moving the functionality into the (previously empty) SubsequentOrderingAssertions the inheritance tree can be simplified.

This should also increase the code coverage according to #1823.

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

coveralls commented Nov 5, 2023

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Nov 5, 2023

Copy link
Copy Markdown

Qodana for .NET

It 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 report

To be able to view the detailed Qodana report, you can either:

  1. Register at Qodana Cloud and configure the action
  2. Use GitHub Code Scanning with Qodana
  3. Host Qodana report at GitHub Pages
  4. Inspect and use qodana.sarif.json (see the Qodana SARIF format for details)

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2023.2.8
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

Comment thread Src/FluentAssertions/Collections/SubsequentOrderingAssertions.cs Outdated
@vbreuss vbreuss changed the title Fix inheritance of SubsequentOrderingAssertions Simplify inheritance of SubsequentOrderingAssertions Nov 9, 2023
@dennisdoomen dennisdoomen requested a review from jnyrup November 9, 2023 09:15
@dennisdoomen dennisdoomen enabled auto-merge (squash) November 9, 2023 09:15
@jnyrup

jnyrup commented Nov 11, 2023

Copy link
Copy Markdown
Member

I don't know or recall why #1416 used SubsequentOrderingAssertions in GenericCollectionAssertions instead of SubsequentOrderingGenericCollectionAssertions.
The latter retains TCollection whereas the former uses IEnumerable<T> which TCollection is constrained to.

Could we use SubsequentOrderingGenericCollectionAssertions instead of SubsequentOrderingAssertions?

@vbreuss

vbreuss commented Nov 11, 2023

Copy link
Copy Markdown
Contributor Author

Could we use SubsequentOrderingGenericCollectionAssertions instead of SubsequentOrderingAssertions?

I don't have any preference regarding the naming. I was simply wondering why it needed so many levels of inheritance and could find no reason for it. Should I rename SubsequentOrderingAssertions to SubsequentOrderingGenericCollectionAssertions?

@jnyrup

jnyrup commented Nov 11, 2023

Copy link
Copy Markdown
Member

Could we use SubsequentOrderingGenericCollectionAssertions instead of SubsequentOrderingAssertions?

I don't have any preference regarding the naming. I was simply wondering why it needed so many levels of inheritance and could find no reason for it. Should I rename SubsequentOrderingAssertions to SubsequentOrderingGenericCollectionAssertions?

Not sure I get you.
I didn't mean rename SubsequentOrderingAssertions to SubsequentOrderingGenericCollectionAssertions, but let the relevant assertions in GenericCollectionAssertions return SubsequentOrderingGenericCollectionAssertions instead of SubsequentOrderingAssertions.

@vbreuss

vbreuss commented Nov 11, 2023

Copy link
Copy Markdown
Contributor Author

Not sure I get you.
I didn't mean rename SubsequentOrderingAssertions to SubsequentOrderingGenericCollectionAssertions, but let the relevant assertions in GenericCollectionAssertions return SubsequentOrderingGenericCollectionAssertions instead of SubsequentOrderingAssertions.

That would practically be the same. All methods were in one class and all other classes were empty. I chose SubsequentOrderingAssertions to keep (move all logic inside and remove the inheritance). Alternatively I could keep the logic in SubsequentOrderingGenericCollectionAssertions and replace all references of SubsequentOrderingAssertions with it.

I expected the first change to have less chance of breaking things, as I don't change the return type of existing methods. That was my reason for choosing this way...

auto-merge was automatically disabled January 3, 2024 14:39

Head branch was pushed to by a user without write access

@github-actions

github-actions Bot commented Jan 3, 2024

Copy link
Copy Markdown

Qodana for .NET

It 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 report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@dennisdoomen

Copy link
Copy Markdown
Member

@jnyrup I think this is waiting for you, isn't it?

@ITaluone

Copy link
Copy Markdown
Contributor

What is the state of this one?

@vbreuss

vbreuss commented Jun 27, 2024

Copy link
Copy Markdown
Contributor Author

I'm not sure. It's more a refactoring change missing a review from @jnyrup.

I can rebase the branch, or abandon the PR.

@dennisdoomen

Copy link
Copy Markdown
Member

Please consider rebasing on develop

@vbreuss

vbreuss commented Oct 24, 2024

Copy link
Copy Markdown
Contributor Author

Please consider rebasing on develop

Oh, wow, you finished your big PR 😊

@vbreuss vbreuss requested a review from dennisdoomen October 24, 2024 18:36
@vbreuss

vbreuss commented Oct 24, 2024

Copy link
Copy Markdown
Contributor Author

@dennisdoomen : I am not sure, why the Qodana build failed, but it seems not to be related with my changes...

@dennisdoomen

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants