You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
grahamrhay edited this page Nov 9, 2010
·
1 revision
#Combinable
Provides an easy way to combine matchers (And/Or):
[Test]publicvoidCombinable_And(){varcontainsCat=Contains.String("cat");varcontainsMat=Contains.String("mat");varmatches=newCombinableMatcher(containsCat).And(containsMat);conststringactual="the cat sat on the mat";Assert.That(actual,matches);// or alternativelyAssert.That(actual,Matches.Both(Contains.String("cat")).And(Contains.String("mat")));}[Test]publicvoidCombinable_Or(){varcontainsCat=Contains.String("cat");varcontainsJohn=Contains.String("john");varmatcher=newCombinableMatcher(containsCat).Or(containsJohn);conststringactual="the cat sat on the mat";Assert.That(actual,matches);// or alternativelyAssert.That(actual,Matches.Either(Contains.String("cat")).Or(Contains.String("john")));}