Exemple #1
1
        public void MaxValueDateTimeIsValid()
        {
            DateTime target = DateTime.Now;
            DateTime comparisonValue = DateTime.Now.AddMinutes(1);
            MaxValue<DateTime> rule = new MaxValue<DateTime>("MaxValueRule", "The target is not valid. Must be equal or less than comparison value.", target, comparisonValue);
            Result result = rule.Execute();

            Assert.IsTrue(result.IsValid);
            Assert.IsNotNullOrEmpty(result.Message);
            Assert.IsNotNull(result.RulePolicy);
            Assert.AreEqual(result.RulePolicy.Severity, Severity.Exception);
        }
Exemple #2
0
        public void MaxValueIntIsValid()
        {
            int            target          = 10;
            int            comparisonValue = 10;
            MaxValue <int> rule            = new MaxValue <int>("MaxValueRule", "The target is not valid. Must be equal or less than comparison value.", target, comparisonValue);
            Result         result          = rule.Execute();

            Assert.IsTrue(result.IsValid);
            Assert.IsNotNullOrEmpty(result.Message);
            Assert.IsNotNull(result.RulePolicy);
            Assert.AreEqual(result.RulePolicy.Severity, Severity.Exception);
        }
Exemple #3
0
        public void MaxValueDateTimeIsValid()
        {
            DateTime            target          = DateTime.Now;
            DateTime            comparisonValue = DateTime.Now.AddMinutes(1);
            MaxValue <DateTime> rule            = new MaxValue <DateTime>("MaxValueRule", "The target is not valid. Must be equal or less than comparison value.", target, comparisonValue);
            Result result = rule.Execute();

            Assert.IsTrue(result.IsValid);
            Assert.IsNotNullOrEmpty(result.Message);
            Assert.IsNotNull(result.RulePolicy);
            Assert.AreEqual(result.RulePolicy.Severity, Severity.Exception);
        }
Exemple #4
-1
        public void MaxValueIntIsValid()
        {
            int target = 10;
            int comparisonValue = 10;
            MaxValue<int> rule = new MaxValue<int>("MaxValueRule", "The target is not valid. Must be equal or less than comparison value.", target, comparisonValue);
            Result result = rule.Execute();

            Assert.IsTrue(result.IsValid);
            Assert.IsNotNullOrEmpty(result.Message);
            Assert.IsNotNull(result.RulePolicy);
            Assert.AreEqual(result.RulePolicy.Severity, Severity.Exception);
        }