Esempio n. 1
0
        public void Test_Constructor()
        {
            //--------------- Set up test pack ------------------
            const string message = "message";
            const ErrorLevel errorLevel = ErrorLevel.Error;
            ClassDef.ClassDefs.Clear();
            MyBO.LoadDefaultClassDef();
            IBusinessObject bo = new MyBO();
            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            BOError boError = new BOError(message, errorLevel);
            //--------------- Test Result -----------------------

            Assert.AreEqual(message, boError.Message);
            Assert.AreEqual(errorLevel, boError.Level);

        }
Esempio n. 2
0
        /// <summary>
        /// Indicates whether all of the property values of the object are valid
        /// </summary>
        /// <param name="errors">If the object is not valid then this list is populated with the errors</param>
        /// <returns>Returns true if all are valid </returns>
        public bool IsValid(out IList <IBOError> errors)
        {
            errors = new List <IBOError>();
            if (IsDeleted)
            {
                return(true);
            }

            bool valid = _bo.Props.IsValid(out errors);

            foreach (BOError error in errors)
            {
                error.BusinessObject = this.BusinessObject;
            }

            IList <IBOError> customRuleErrors;

            valid &= _bo.AreCustomRulesValidInternal(out customRuleErrors);
            if (customRuleErrors != null)
            {
                foreach (BOError error in customRuleErrors)
                {
                    error.BusinessObject = this.BusinessObject;
                    errors.Add(error);
                }
            }

            string customRuleErrorsString;

            valid &= _bo.AreCustomRulesValidInternal(out customRuleErrorsString);
            if (!String.IsNullOrEmpty(customRuleErrorsString))
            {
                BOError customError = new BOError(customRuleErrorsString, ErrorLevel.Error)
                {
                    BusinessObject = this.BusinessObject
                };
                errors.Add(customError);
            }

            return(valid);
        }
Esempio n. 3
0
        /// <summary>
        /// Indicates whether all of the property values of the object are valid
        /// </summary>
        /// <param name="errors">If the object is not valid then this list is populated with the errors</param>
        /// <returns>Returns true if all are valid </returns>
        public bool IsValid(out IList<IBOError> errors)
        {
            errors = new List<IBOError>();
            if (IsDeleted) return true;

            bool valid = _bo.Props.IsValid(out errors);
            foreach (BOError error in errors)
            {
                error.BusinessObject = this.BusinessObject;
            }

            IList<IBOError> customRuleErrors;
            valid &= _bo.AreCustomRulesValidInternal(out customRuleErrors);
            if (customRuleErrors != null)
            {
                foreach (BOError error in customRuleErrors)
                {
                    error.BusinessObject = this.BusinessObject;
                    errors.Add(error);
                }
            }

            string customRuleErrorsString;
            valid &= _bo.AreCustomRulesValidInternal(out customRuleErrorsString);
            if (!String.IsNullOrEmpty(customRuleErrorsString))
            {
                BOError customError = new BOError(customRuleErrorsString, ErrorLevel.Error)
                                          {BusinessObject = this.BusinessObject};
                errors.Add(customError);
            }

            return valid;
        }