Skip to content
grahamrhay edited this page Nov 9, 2010 · 1 revision

#DescribedAs

Decorates a matcher, and overrides the description:

    [Test]
    public void DescribedAs()
    {
        var containsCat = Contains.String("cat");
        var description = new StringDescription();        
        containsCat.DescribeTo(description);
        Assert.That(description.ToString(), Is.EqualTo("cat");
        
        const string catDescription = "this is a cat";
        var descriptiveCat = containsCat.DescribedAs(catDescription);
        description = new StringDescription();        
        descriptiveCat.DescribeTo(description);
        Assert.That(description.ToString(), Is.EqualTo(catDescription);
    }
Clone this wiki locally