public void Describe_matcher() { var subMatcher = new CustomMatcher <string>("Sub-matcher description", s => s == "test"); var matcher = new TestFeatureMatcher(subMatcher, "Feature description", ""); var description = new StringDescription(); matcher.DescribeTo(description); Assert.Equal("Feature description Sub-matcher description", description.ToString()); }
public void No_match_if_submatcher_fails() { var subMatcher = new CustomMatcher <string>("Sub-matcher", s => s == "test"); var matcher = new TestFeatureMatcher(subMatcher, "", ""); var matches = matcher.Matches(new TestObject { Name = "bob" }); Assert.False(matches, "Expected no match."); }
public void Match_if_submatcher_does() { const string name = "test"; var subMatcher = new CustomMatcher <string>("Sub-matcher", s => s == name); var matcher = new TestFeatureMatcher(subMatcher, "", ""); var matches = matcher.Matches(new TestObject { Name = name }); Assert.True(matches, "Expected match."); }
public void Describe_mismatch() { var subMatcher = new CustomMatcher <string>("Sub-matcher", s => s == "test"); var matcher = new TestFeatureMatcher(subMatcher, "", "TestObject.Name"); var description = new StringDescription(); matcher.DescribeMismatch(new TestObject { Name = "bob" }, description); Assert.Equal("TestObject.Name was bob", description.ToString()); }