Skip to content

Feature Request: Assert Collection contains Element that “IsEquivalentTo” #584

@matthiaslischka

Description

@matthiaslischka

Hi,
I'm still not sure if I just miss something or if this does not exist yet at all.
I'm looking for some mix of ShouldBeEquivalentTo and ShouldAllBeEquivalentTo.

I want to assert that a Collection contains an element that is equivalent to.

Since the comparing logic already exists within the *BeEquivalentTo methods I probably miss the correct way of writing my assertion. Sorry if thats the case.
What I want to do could look like:

var objectList = new List<SomeClass> { new SomeClass("A"), new SomeClass("B"), new SomeClass("C") };
objectList.ShouldContainEquivalentTo(new SomeClass("B"));

Thx in advance and BR,
Matthias

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions