Visitar URL original
Equivalency assertion for dictionary does not include because message · Issue #2293 · fluentassertions/fluentassertions · GitHub
Skip to content

Equivalency assertion for dictionary does not include because message #2293

Closed

Description

@jnyrup

Description

When comparing the values of dictionaries for equivalency, the because message is not included in the failure message.

Reproduction Steps

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

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

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

Expected behavior

Exception message should include FOO

Actual behavior

FluentAssertions.Execution.AssertionFailedException: 'Expected subject[a] to be a collection with 1 item(s), but found an empty collection.

With configuration:
- Use declared types and members
- Compare enums by value
- Compare tuples by their properties
- Compare anonymous types by their properties
- Compare records by their members
- Include non-browsable members
- Match member by name (or throw)
- Be strict about the order of items in byte arrays
- Without automatic conversion.
'

Regression?

no

Known Workarounds

No response

Configuration

Fluent Assertions 6.12
.NET 8.0

Other information

No response

Could you help with a pull-request?

Yes

Activity

  1. added this to the 7.0 milestone on Sep 11, 2023
  2. moved this to 📋 Backlog in v8on Sep 17, 2023
  3. added a commit that references this issue on Sep 24, 2023
    5f28ea5
  4. IT-VBFK commented on Sep 24, 2023

    @IT-VBFK
    Contributor

    I discovered, that this is not specifically only for dictionaries, but for all equivalency checks on nested collections (at least nested collection inside dictionaries).

    Could you help with a pull-request?

    Yes

    Edit: Sorry @jnyrup ;)

  5. jnyrup commented on Sep 24, 2023

    @jnyrup
    MemberAuthor

    Could you help with a pull-request?
    Yes

    Edit: Sorry @jnyrup ;)

    haha, I was in doubt what to answer to that question 😅

  6. added 6 commits that reference this issue on Sep 24, 2023
    679605c
    4facf45
    982f20f
    4516b16
    e875558
    36a6a4d
  7. moved this from 📋 Backlog to 👀 In review in v8on Sep 25, 2023
  8. added a commit that references this issue on Sep 28, 2023
    35ba8dc
  9. moved this from 👀 In review to ✅ Done in v8on Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions