Skip to content

ContainEquivalentOf fails unexpectedly #1795

@lonix1

Description

@lonix1

Description

I'm trying compare two collections, which should be equivalent. But the test fails.

Complete minimal example reproducing the issue

using System.Security.Claims;
using FluentAssertions;
using Xunit;

public class Tests {

  [Fact]
  public void collections_should_be_equivalent() {

    var collection1 = new List<Claim> {
        new Claim("foo", "bar"),
        new Claim("spam", "ham"),
      };

    var collection2 = new List<Claim> {
        new Claim("foo", "bar"),
        new Claim("spam", "ham"),
      };

    collection2.Should().ContainEquivalentOf(collection1);
  }

}

I also tried collection2.Should().ContainEquivalentOf(collection1, o => o.WithTracing()); but that doesn't provide tracing info, and when debugging, it throws XunitException.

Expected behavior:

I expect the test to pass.

Actual behavior:

The test fails.

Outcome: Failed
Error Message:
Expected collection2 {foo: bar, spam: ham} to contain equivalent of {foo: bar, spam: ham}.

Versions

  • Which version of Fluent Assertions are you using? 6.2.0
  • Which .NET runtime and version are you targeting? .NET SDK 6.0.101, but my project targets 5.0.404

Additional Information

I don't understand why the WithTracing option doesn't work - any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions