Skip to content

A collection of key value pairs is no longer equivalent to a dictionary #1598

@dennisdoomen

Description

@dennisdoomen

Description

[Description of the issue]

Complete minimal example reproducing the issue

[Fact]
public void When_a_collection_of_key_value_pairs_is_equivalent_to_the_dictionary_it_should_succeed()
{
    // Arrange
    var collection = new List<KeyValuePair<string, int>> { new KeyValuePair<string, int>("hi", 1) };

    // Act / Assert
    Action act = () => collection.Should().BeEquivalentTo(new Dictionary<string, int>()
    {
        { "hi", 2 }
    });

    act.Should().Throw<XunitException>().WithMessage("Expected item[0].Value to be 2, but found 1.*");
}

Expected behavior:

The test passes

Actual behavior:

Expected collection (of type Dictionary<string, int>) to be a System.Collections.Generic.IDictionary`2[System.String,System.Int32],
 but found a System.Collections.Generic.List`1[System.Collections.Generic.KeyValuePair`2[System.String,System.Int32]].

Versions

6.0 Beta 1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions