Skip to content

Assert that a large enumerable contains only the very same item n times? #914

@drauch

Description

@drauch

I have a collection of 100K sample numbers. In one test case I want to assert that all of them are of the same value. I tried:

values.Should().AllBeEquivalentTo(5);

This takes quite some time (around five seconds). Which is WAY to long. Is this a bug in the implementation? Why is it taking so long? I think it's the wrong function, but I couldn't find a .AllBe(5) for which I was looking for originally.

My workaround now is values.Distinct().Should().BeEquivalentTo(new[]{5}); but I don't like it because it doesn't express my intent.

Ideas on how to do that properly?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions