Skip to content

IsCollectionContaining

grahamrhay edited this page Nov 11, 2010 · 1 revision

#IsCollectionContaining

Matches if any item in the collection meets the criteria:

    [Test]
    public void IsCollectionContaining()
    {
        var matchesCat = Contains.String("cat");
        var containsCat = new IsCollectionContaining(matchesCat);
        var actual = new[] { "the", "cat", "sat", "on", "the", "mat" };

        Assert.That(actual, containsCat);
        // or alternatively
        Assert.That(new[] { "aaa", "bbb", "ccc" }, Has.Items("aaa", "bbb"));
    }
Clone this wiki locally