Exemplo n.º 1
0
        public void Test_WithNullValue_ShouldReturnEmptyErrorMessage()
        {
            var rule         = new PropRuleShort("num", "TestMessage", 5, 10);
            var errorMessage = "";

            Assert.IsTrue(rule.IsPropValueValid("Propname", null, ref errorMessage));
            Assert.IsTrue(errorMessage.Length == 0);
        }
Exemplo n.º 2
0
        public void Test_WithNullValue_ShouldReturnEmptyErrorMessage()
        {
            var rule = new PropRuleShort("num", "TestMessage", 5, 10);
            var errorMessage = "";

            Assert.IsTrue(rule.IsPropValueValid("Propname", null, ref errorMessage));
            Assert.IsTrue(errorMessage.Length == 0);
        }
Exemplo n.º 3
0
        public void Test_WithValueGTMax_ShouldReturnErrorMessage()
        {
            var rule         = new PropRuleShort("num", "TestMessage", 5, 10);
            var errorMessage = "";

            Assert.IsFalse(rule.IsPropValueValid("Propname", 12, ref errorMessage));
            Assert.IsTrue(errorMessage.Length > 0);
        }
Exemplo n.º 4
0
        public void Test_WithNegativeNumber_ShouldReturnErrorMessage()
        {
            string errorMessage = "";
            var    rule         = new PropRuleShort("num", "TestMessage", 5, 10);

            Assert.IsFalse(rule.IsPropValueValid("Propname", -5, ref errorMessage));
            Assert.IsTrue(errorMessage.Length > 0);
        }
Exemplo n.º 5
0
        public void Test_WithValueGTMax_ShouldReturnErrorMessage()
        {
            var rule = new PropRuleShort("num", "TestMessage", 5, 10);
            var errorMessage = "";

            Assert.IsFalse(rule.IsPropValueValid("Propname", 12, ref errorMessage));
            Assert.IsTrue(errorMessage.Length > 0);
        }
Exemplo n.º 6
0
        public void Test_WithNegativeNumber_ShouldReturnErrorMessage()
        {
            string errorMessage = "";
            var rule = new PropRuleShort("num", "TestMessage", 5, 10);

            Assert.IsFalse(rule.IsPropValueValid("Propname", -5, ref errorMessage));
            Assert.IsTrue(errorMessage.Length > 0);
        }
Exemplo n.º 7
0
        public void Test_ValueLTMin_ShouldReturnErrorMessage()
        {
            var rule         = new PropRuleShort("num", "TestMessage", 5, 10);
            var errorMessage = "";

            //Test less than min
            Assert.IsFalse(rule.IsPropValueValid("Propname", 1, ref errorMessage));
            Assert.IsTrue(errorMessage.Length > 0);
        }
Exemplo n.º 8
0
        public void Test_ValueLTMin_ShouldReturnErrorMessage()
        {
            var rule = new PropRuleShort("num", "TestMessage", 5, 10);
            var errorMessage = "";

            //Test less than min
            Assert.IsFalse(rule.IsPropValueValid("Propname", 1, ref errorMessage));
            Assert.IsTrue(errorMessage.Length > 0);
        }
Exemplo n.º 9
0
        public void IsPropValueValid_GivenValueOutsideShortRange_ShouldReturnFalse()
        {
            //---------------Set up test pack-------------------
            var rule         = new PropRuleShort("num", "");
            var errorMessage = "";
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var valid = rule.IsPropValueValid("num", int.MaxValue, ref errorMessage);

            //---------------Test Result -----------------------
            Assert.IsFalse(valid);
        }
Exemplo n.º 10
0
        public void IsPropValueValid_GivenValueOutsideShortRange_ShouldReturnFalse()
        {
            //---------------Set up test pack-------------------
            var rule = new PropRuleShort("num", "");
             var errorMessage = "";
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var valid = rule.IsPropValueValid("num", int.MaxValue, ref errorMessage);
            //---------------Test Result -----------------------
            Assert.IsFalse(valid);
        }