IsValid() public method

This is not implemented for InterPropRules since it is obsolete.
public IsValid ( ) : bool
return bool
Ejemplo n.º 1
0
 public void Test_IsValid_WhenLeftPropNull_ShouldRetTrue()
 {
     //---------------Set up test pack-------------------
     PropDefFake propLeft = new PropDefFake();
     PropDefFake propRight = new PropDefFake();
     InterPropRule rule = new InterPropRule(propLeft, ComparisonOperator.GreaterThan, propRight);
     DateTime? prop1Value = null;
     DateTime? prop2Value = DateTime.Now;
     IBusinessObject bo = GetBOWithPropValueSet(propLeft, prop1Value, propRight, prop2Value);
     //---------------Assert Precondition----------------
     Assert.IsNull(bo.GetPropertyValue(propLeft.PropertyName));
     //---------------Execute Test ----------------------
     bool isValid = rule.IsValid(bo);
     //---------------Test Result -----------------------
     Assert.IsTrue(isValid);
 }
Ejemplo n.º 2
0
 public void Test_IsValid_WhenGt_WhenEq_ShouldBeFalse()
 {
     //---------------Set up test pack-------------------
     PropDefFake prop1 = new PropDefFake();
     PropDefFake prop2 = new PropDefFake();
     InterPropRule rule = new InterPropRule(prop1, ComparisonOperator.GreaterThan, prop2);
     DateTime propValue = DateTime.Now;
     IBusinessObject bo = GetBOWithPropValueSet(prop1, propValue, prop2, propValue);
     //---------------Assert Precondition----------------
     Assert.AreEqual((DateTime)bo.GetPropertyValue(prop1.PropertyName), (DateTime)bo.GetPropertyValue(prop2.PropertyName));
     //---------------Execute Test ----------------------
     bool isValid = rule.IsValid(bo);
     //---------------Test Result -----------------------
     Assert.IsFalse(isValid);
 }
Ejemplo n.º 3
0
        public void Test_IsValid_WhenGt_WhenNotGtEqual_ShouldBeFalse()
        {
            //---------------Set up test pack-------------------
            PropDefFake prop1 = new PropDefFake();
            PropDefFake prop2 = new PropDefFake();
            InterPropRule rule = new InterPropRule(prop1, ComparisonOperator.GreaterThan, prop2);
            DateTime prop1Value = DateTime.Now.AddDays(-1);
            DateTime prop2Value = DateTime.Now;
            IBusinessObject bo = GetBOWithPropValueSet(prop1, prop1Value, prop2, prop2Value);
            //---------------Assert Precondition----------------
            Assert.Less((DateTime)bo.GetPropertyValue(prop1.PropertyName), (DateTime)bo.GetPropertyValue(prop2.PropertyName));
            //---------------Execute Test ----------------------
            bool isValid = rule.IsValid(bo);
            //---------------Test Result -----------------------
            Assert.IsFalse(isValid);
            string expectedMessage = string.Format("Property '{0}' with value '{1}'  should "
                                                   + "be GreaterThan property '{2}' with value '{3}'"
                                                   , prop1.PropertyName, prop1Value, prop2.PropertyName, prop2Value);

            Assert.AreEqual(expectedMessage, rule.Message);
        }
Ejemplo n.º 4
0
 public void Test_IsValid_WhenLTPasses_ShouldBeTrue()
 {
     //---------------Set up test pack-------------------
     PropDefFake prop1 = new PropDefFake();
     PropDefFake prop2 = new PropDefFake();
     InterPropRule rule = new InterPropRule(prop1, ComparisonOperator.LessThan, prop2);
     IBusinessObject bo = GetBOWithPropValueSet(prop1, DateTime.Now.AddDays(-1), prop2, DateTime.Now);
     //---------------Assert Precondition----------------
     Assert.Less((DateTime)bo.GetPropertyValue(prop1.PropertyName), (DateTime)bo.GetPropertyValue(prop2.PropertyName));
     //---------------Execute Test ----------------------
     bool isValid = rule.IsValid(bo);
     //---------------Test Result -----------------------
     Assert.IsTrue(isValid);
 }