public void HasRulesTest()
        {
            var rule = new BusinessRule
            {
                Description = "test"
            };

            var rules = new BusinessRuleCollection();

            Assert.IsFalse(rules.HasRules());

            rules.AddRule(rule);

            Assert.IsTrue(rules.HasRules());
        }
Esempio n. 2
0
        private void ThrowExceptionIfUserIsInvalid(Domain.User.User newUser)
        {
            var brokenRules = new BusinessRuleCollection(_userValidator.GetBrokenRules(newUser));

            if (brokenRules.HasRules())
            {
                throw new ValidationException(brokenRules.GetRulesSummary());
            }
        }
Esempio n. 3
0
        private void ThrowExceptionIfTaskIsInvalid(Domain.Task.Task newTask)
        {
            var brokenRules = new BusinessRuleCollection(_taskValidator.GetBrokenRules(newTask));

            if (brokenRules.HasRules())
            {
                throw new ValidationException(brokenRules.GetRulesSummary());
            }
        }