Skip to content

Conversation

@IT-VBFK
Copy link
Contributor

@IT-VBFK IT-VBFK commented Sep 24, 2023

This fixes #2293

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 Sep 24, 2023

Pull Request Test Coverage Report for Build 6303140294

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 97.277%

Totals Coverage Status
Change from base Build 6302426774: 0.0%
Covered Lines: 11631
Relevant Lines: 11837

💛 - Coveralls

@github-actions
Copy link

github-actions bot commented Sep 24, 2023

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/[email protected]
        with:
          upload-result: true
Contact Qodana team

Contact us at [email protected]

@IT-VBFK
Copy link
Contributor Author

IT-VBFK commented Sep 24, 2023

Qodana thinks we aren't in pr_mode? 🤔

@jnyrup
Copy link
Member

jnyrup commented Sep 24, 2023

Qodana thinks we aren't in pr_mode? 🤔

We fiddled with the Qodana pipeline today. Apparently we didn't nail it 😞
I have pushed a change to develop 🤞
Try rebasing on develop.

@IT-VBFK IT-VBFK force-pushed the fix/pass-down-the-reason-to-inner-equivalency-check branch from 7090025 to 0e271cf Compare September 24, 2023 18:44
@jnyrup
Copy link
Member

jnyrup commented Sep 24, 2023

Try rebasing one more time.

image

@IT-VBFK IT-VBFK force-pushed the fix/pass-down-the-reason-to-inner-equivalency-check branch from 0e271cf to cc50769 Compare September 24, 2023 19:38
@IT-VBFK
Copy link
Contributor Author

IT-VBFK commented Sep 24, 2023

Can I close #2319 then?

@jnyrup
Copy link
Member

jnyrup commented Sep 24, 2023

Can I close #2319 then?

Yes.

@IT-VBFK
Copy link
Contributor Author

IT-VBFK commented Sep 25, 2023

What's fishy: if I comment AssertionScope.Current.BecauseOf(context.Reason); and add another test

[Fact]
public void Passing_the_reason_to_the_inner_equivalency_assertion_works_2()
{
    var subject = new Dictionary<string, object>
    {
        ["a"] = new List<int>()
    };

    var expected = new Dictionary<string, object>
    {
        ["a"] = new List<int> { 42 },
        ["b"] = new List<int> { 42 }
    };

    subject.Should().BeEquivalentTo(expected, "FOO");
}

The failure message is: Expected subject to be a dictionary with 2 item(s) because FOO, but it misses key(s) {"b"}

@jnyrup @dennisdoomen Why? I don't get it, because the assertion which is throwing is the subsequent assertion here:

private static Continuation AssertCollectionsHaveSameCount<T>(ICollection<object> subject, ICollection<T> expectation)
{
return AssertionScope.Current
.WithExpectation("Expected {context:subject} to be a collection with {0} item(s){reason}", expectation.Count)
.AssertEitherCollectionIsNotEmpty(subject, expectation)
.Then
.AssertCollectionHasEnoughItems(subject, expectation)
.Then
.AssertCollectionHasNotTooManyItems(subject, expectation)
.Then
.ClearExpectation();
}

(AssertCollectionHasEnoughItems)

Edit: Oh.. I see: I miss-tested this 🤦‍♂️

@IT-VBFK IT-VBFK force-pushed the fix/pass-down-the-reason-to-inner-equivalency-check branch 3 times, most recently from ca4ddd5 to 7f5ff3e Compare September 25, 2023 17:57
@jnyrup jnyrup added the bug label Sep 25, 2023
@IT-VBFK IT-VBFK force-pushed the fix/pass-down-the-reason-to-inner-equivalency-check branch from 7f5ff3e to 5b8c3d0 Compare September 25, 2023 18:06
@IT-VBFK IT-VBFK changed the title Pass down the reason to inner equivalency check for nested collections Pass down the reason to inner equivalency check for nested AssertionScopes Sep 25, 2023
@IT-VBFK IT-VBFK changed the title Pass down the reason to inner equivalency check for nested AssertionScopes Pass down the reason to inner AssertionScopes Sep 25, 2023
@IT-VBFK IT-VBFK changed the title Pass down the reason to inner AssertionScopes Pass down the reason to inner AssertionScope Sep 25, 2023
@jnyrup
Copy link
Member

jnyrup commented Sep 27, 2023

Something's up with our Qodana pipeline.
It seems to be scanning the wrong commit.

@dennisdoomen
Should this line

ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
also use pull_request_target instead of pull_request?

@dennisdoomen
Copy link
Member

also use pull_request_target instead of pull_request?

No, there's no such thing. Instead, I think we should use

ref: "${{ github.event.pull_request.merge_commit_sha }}"

See also actions/checkout#518 (comment)

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Equivalency assertion for dictionary does not include because message

4 participants