public static void Ostrich(this IAn <object> continuation) { continuation.AddMatcher( o => { var passed = o is Ostrich; return(new MatcherResult( passed, () => passed ? "Expected not to get an Ostrich" : "Expected to get an Ostrich")); }); }
public static void Ostrich <T>(this IAn <T> an) { an.AddMatcher(item => { var asOstrich = item as Ostrich; var passed = asOstrich != null && asOstrich.Legs == 2 && asOstrich.Habitat == Habitats.Savanna && asOstrich.Colors.Contains(Colors.Black) && asOstrich.Colors.Contains(Colors.White) && !asOstrich.Colors.Contains(Colors.Pink); var not = passed ? "" : "not "; return(new MatcherResult( passed, $"Expected {item} {not}to be an ostrich" )); }); }