Skip to content

ShouldContain* method's output #14

@KarsonAlford

Description

@KarsonAlford

When the lists being compared are large the output when they do not match is difficult to read.

In some cases I filter out the duplicates before calling the ShouldContain* method. Should this be done by Given?

        List<string> expectedValues;
        List<string> resultValues;

        // Remove identical items improves error messages.
        foreach (string o in expectedValues.Clone())
        {
            if (resultValues.Remove(o))
            {
                expectedValues.Remove(o);
            }
        }

        then(() => { resultValues.ShouldContainOnly(expectedValues); });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions