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

#CustomMatcher

For a quick and easy custom matcher:

    [Test]
    public void CustomMatcher()
    {
        var aFruit = new Fruit(Color.Orange);
        var isOrange = new CustomMatcher<Fruit>("orange", f => f.Colour == Color.Orange);

        Assert.That(aFruit, isOrange);
    }

    public class Fruit 
    {
        public Color Colour { get; private set; }

        public Fruit(Color colour)
        {
            Colour = colour;
        }
    }
Clone this wiki locally