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 11, 2010
·
1 revision
#FeatureMatcher
A FeatureMatcher<T, U> allows you to focus in on one part of an object:
publicclassPostcodeMatcher:FeatureMatcher<Address,string>{publicPostcodeMatcher(IMatcher<string>subMatcher,stringfeatureDescription):base(subMatcher,featureDescription,"Postcode"){}protectedoverridestringFeatureValueOf(Addressactual){returnaddress.Postcode;}}[Test]publicvoidMatch_postcode(){varmatchesPostcode=newPostcodeMatcher(Is.EqualTo("N1 5TF"),"Postcode is N1 5TF");varaddress=newAddress{Postcode="N15TF"};Assert.That(address,matchesPostcode);}