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);
        }
示例#2
0
        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);
        }
示例#4
0
        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);
        }
示例#6
0
        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);
        }