public void Facade__WhenDefault() { IConvention <string, string> testing = new TestConvention <string>().WhenDefault(); Assert.IsTrue(testing.AppliesTo(null)); Assert.IsFalse(testing.AppliesTo("string")); }
public void Facade__When() { IConvention <string, string> testing = new TestConvention <string>().When("match"); Assert.IsTrue(testing.AppliesTo("match")); Assert.IsFalse(testing.AppliesTo("nomatch")); }
public void When_given__AppliesTo_returns_condition_s_output() { IConvention <string, string> testing = new TestConvention <string>().When(o => o == "valid"); Assert.IsTrue(testing.AppliesTo("valid")); Assert.IsFalse(testing.AppliesTo("invalid")); }
public void Calling_when_more_than_once_chains_predicates_with_and() { IConvention <string, string> testing = new TestConvention <string>().When(o => o.Contains("valid")).When(o => !o.Contains("in")); Assert.IsTrue(testing.AppliesTo("valid")); Assert.IsFalse(testing.AppliesTo("invalid")); }
public void When_no_condition_is_given__AppliesTo_always_returns_true() { IConvention <string, string> testing = new TestConvention <string>(); Assert.IsTrue(testing.AppliesTo("any")); }