Skip to content

Asserting .Contains on types that inherit an enumerable fails to compile #3401

@robertcoltheart

Description

@robertcoltheart

See the below test case which will fail to compile on v0.70.0+

public class TestCases
{
    [Test]
    public async Task Test()
    {
        var list = new List<string>();
        var inherited = new Inherited();

        await Assert.That(list).Contains(x => x == "abc"); // Works fine
        await Assert.That(inherited).Contains(x => x == "abc"); // Doesn't compile
    }

    public class Inherited : List<string>;
}

This was working on TUnit versions pre-0.70.0

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