-
Notifications
You must be signed in to change notification settings - Fork 9
Combinable
grahamrhay edited this page Nov 9, 2010
·
1 revision
#Combinable
Provides an easy way to combine matchers (And/Or):
[Test]
public void Combinable_And()
{
var containsCat = Contains.String("cat");
var containsMat = Contains.String("mat");
var matches = new CombinableMatcher(containsCat).And(containsMat);
const string actual = "the cat sat on the mat";
Assert.That(actual, matches);
// or alternatively
Assert.That(actual, Matches.Both(Contains.String("cat")).And(Contains.String("mat")));
}
[Test]
public void Combinable_Or()
{
var containsCat = Contains.String("cat");
var containsJohn = Contains.String("john");
var matcher = new CombinableMatcher(containsCat).Or(containsJohn);
const string actual = "the cat sat on the mat";
Assert.That(actual, matches);
// or alternatively
Assert.That(actual, Matches.Either(Contains.String("cat")).Or(Contains.String("john")));
}