public void Coerce_Throws_Exception_For_Invalid_Expression_Strings() { const string value = "("; var coercer = new RegexCoercerAttribute(); Regex result; coercer.Coerce(value, null, null, out result); }
public void Coerce_Returns_Regex_For_Valid_Expression_Strings() { const string value = ".*"; var coercer = new RegexCoercerAttribute(); Regex result; var coerced = coercer.Coerce(value, null, null, out result); Assert.IsNotNull(result); Assert.IsTrue(coerced); }
public void Coerce_Returns_Null_For_Types_Other_Than_Regex() { const int expected = default(int); const string value = ".*"; var coercer = new RegexCoercerAttribute(); int result; var coerced = coercer.Coerce(value, null, null, out result); Assert.AreEqual(expected, result); Assert.IsFalse(coerced); }