Example #1
0
        /// <summary>
        /// Gets the ext exception message string.
        /// </summary>
        /// <param name="ex">The ex.</param>
        /// <param name="handleExp">if set to <c>true</c> [handle exp].</param>
        /// <returns></returns>
        public string GetExtExceptionMessageString(Exception ex, bool handleExp)
        {
            StringBuilder msg = new StringBuilder();

            if (ex is BRException)
            {
                BusinessRuleErrorList errors = ((BRException)ex).RuleErrors;
                foreach (BusinessRuleError err in errors)
                {
                    //msg.Append(err.ColumnTitle).Append(":").Append(err.ErrorDescription).Append("\r\n");
                    msg.Append(err.ErrorDescription).Append("\r\n");
                }

                if (errors.Count == 0)
                {
                    msg.Append(ex.Message);
                }
            }
            else if (ex is UserException)
            {
                msg.Append(ex.Message.ToString());
            }
            else
            {
                if (handleExp)
                {
                    FWUtils.ExpLogUtils.ExceptionHandler.HandleException(ref ex, PolicyName.GlobalPolicy);
                }
                msg = msg.Append(ex.Message);
            }

            return(msg.ToString());
        }
Example #2
0
        public void ValidateUserNameTest8()
        {
            UserBR target = CreateNewUserBR();
            BusinessRuleErrorList errors = new BusinessRuleErrorList();
            RuleFunctionSEnum     fnName = RuleFunctionSEnum.Insert;
            bool throwIfErrors           = false;

            List <string> validUserNames = new List <string>();

            //validUserNames.Add("1Mohammad.Ali.Ghaderi"); // starts with number
            validUserNames.Add("Mohammad._Ali_Ghaderi"); // has two characters ._
            validUserNames.Add("Mohammad.Ali_.Ghaderi"); // has two characters _.
            validUserNames.Add("Mohammad1234.");         // ends with .
            validUserNames.Add(".Mohammad1234");         // starts with a symbol
            validUserNames.Add("_Mohammad1234");         // starts with a symbol
            validUserNames.Add("Mohammad!Ali");          // Contains invalid symbol
            validUserNames.Add("Mohammad Ali");          // Contains invalid symbol

            for (int i = 0; i < validUserNames.Count; i++)
            {
                bool isValid = target.ValidateUserName(validUserNames[i], null, errors, fnName, throwIfErrors);
                if (isValid)
                {
                    throw new Exception(validUserNames[i] + " shouldn't be a valid user name.");
                }
            }
        }
Example #3
0
        /// <summary>
        /// Validates the name of the user.
        /// </summary>
        /// <param name="value">Name of the user.</param>
        /// <param name="idValue">id value of the entity. It will be used in update mode to check duplicate</param>
        /// <param name="fnName">Business rule function if it is insert or update</param>
        /// <param name="errors">The errors.</param>
        /// <param name="throwIfErrors">Throw BRException if an error happened</param>
        public bool ValidateUserName(string value, long?idValue, BusinessRuleErrorList errors, RuleFunctionSEnum fnName, bool throwIfErrors)
        {
            int errCount = errors.Count;

            if (CheckUtils.CheckStringShouldNotBeNullOrEmpty(vUser.ColumnNames.UserName, value, errors) == false)
            {
                if (throwIfErrors && errors.Count > errCount)
                {
                    throw new BRException(errors);
                }
                else
                {
                    return(false);
                }
            }

            string colName = vUser.ColumnNames.UserName;

            //Must consist at least two characters that are alpha characters a-zA-Z
            //Must consist only ONE underscore or dash allowed anywhere AFTER the first check,
            //the dash/underscore cannot be at the end as the same rule to apply as the first step
            //Must be alpha-numeric characters.

            //var colInfo = this.Entity.EntityColumns[User.ColumnNames.UserName];

            if (fnName == RuleFunctionSEnum.Delete)
            {
                return(true);
            }

            // DEVELOPER NOTE: Change this pattern with pattern specified in UI in FWHtml.cs file for editor
            // format check
            // http://stackoverflow.com/questions/3588623/c-sharp-regex-for-a-username-with-a-few-restrictions
            string valuePattern = @"^(?=.{5,50}$)([A-Za-z0-9][._]?)*$";

            //(?=.{5,50}$)                   Must be 5-50 characters in the string
            //([A-Za-z0-9][._()\[\]-]?)*   The string is a sequence of alphanumerics,
            //                              each of which may be followed by a symbol
            if (System.Text.RegularExpressions.Regex.IsMatch(
                    value, valuePattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase) == false)
            {
                errors.Add(colName, BusinessErrorStrings.User.UserName_RegularExpressionCheck
                           );
            }

            // duplicate check
            if (errors.Count == 0)       // Perfomance: We check database only if no error is there.
            {
                value = value.ToLower(); // we store all user names in lower case
                CheckUtils.CheckDuplicateValueNotToBeExists(colName, value, idValue, errors, null, fnName == RuleFunctionSEnum.Insert, BusinessErrorStrings.User.UserName_DuplicateUserName);
            }

            if (errors.Count > 0 && throwIfErrors)
            {
                throw new BRException(errors);
            }

            return(errors.Count == 0);
        }
Example #4
0
        public void CheckRulesTest()
        {
            UserBR                target = CreateNewUserBR();
            User                  user   = CreateNewUserObject();
            RuleFunctionSEnum     fnName = RuleFunctionSEnum.Insert;
            BusinessRuleErrorList errors = new BusinessRuleErrorList();

            target.CheckRules(user, fnName, errors);
            Assert.IsTrue(errors.Count > 5);
        }
Example #5
0
        //Please write your properties and functions here. This part will not be replaced.

        public override void CheckRules(object entitySet, RuleFunctionSEnum fnName, BusinessRuleErrorList errors)
        {
            base.CheckRules(entitySet, fnName, errors);
            VitalValue o = (VitalValue)entitySet;

            if (CheckUtils.DateTimeLessThanUtcNow(o.RecordDateTime, vVitalValue.ColumnNames.RecordDateTime, errors))
            {
                CheckUtils.DateTimeIsInUnixRange(o.RecordDateTime, vVitalValue.ColumnNames.RecordDateTime, errors);
            }
        }
Example #6
0
        //Please write your properties and functions here. This part will not be replaced.

        public override void CheckRules(object entitySet, RuleFunctionSEnum fnName, BusinessRuleErrorList errors)
        {
            base.CheckRules(entitySet, fnName, errors);

            //Visit visit = (Visit) entitySet;

            if (fnName == RuleFunctionSEnum.Insert)
            {
            }
        }
        public void InsertTest()
        {
            TestUtils.Security.SetCurrentUser(TestEnums.User.constDoctorID);

            // happy scenario insert without any problem
            var doctorSchedule = DoctorScheduleServiceTest.CreateNewDoctorSchedule();
            DoctorScheduleBR      doctorScheduleBR = (DoctorScheduleBR)EntityFactory.GetEntityBusinessRuleByName(vDoctorSchedule.EntityName, "");
            BusinessRuleErrorList errorsList       = new BusinessRuleErrorList();

            doctorScheduleBR.CheckRules(doctorSchedule, RuleFunctionSEnum.Insert, errorsList);
            Assert.AreEqual(0, errorsList.Count);
        }
Example #8
0
        /// <summary>
        /// Validates the phone number
        /// </summary>
        /// <param name="value">Phone Number</param>
        /// <param name="idValue">id value of the entity. It will be used in update mode to check duplicate</param>
        /// <param name="fnName">Business rule function if it is insert or update</param>
        /// <param name="canBeNull">See if Phone number can be null or empty</param>
        /// <param name="errors">The errors.</param>
        /// <param name="throwIfErrors">Throw BRException if an error happened</param>
        public bool ValidatePhoneNumber(string value, long?idValue, bool canBeNull, BusinessRuleErrorList errors, RuleFunctionSEnum fnName, bool throwIfErrors)
        {
            int errCount = errors.Count;

            // To simplify Signup, we removed Phone number as mandatory
            // in addition, RegisterAndLogin option doesn't need to have a phone number
            // However, if a phone number is provided, we need to check its format
            if (string.IsNullOrEmpty(value) && canBeNull)
            {
                return(true);
            }

            if (CheckUtils.CheckStringShouldNotBeNullOrEmpty(vUser.ColumnNames.PhoneNumber, value, errors) == false)
            {
                if (throwIfErrors && errors.Count > errCount)
                {
                    throw new BRException(errors);
                }
                else
                {
                    return(false);
                }
            }

            string colName = vUser.ColumnNames.PhoneNumber;

            if (fnName == RuleFunctionSEnum.Delete)
            {
                return(true);
            }

            if (IsValidPhoneNumberE164(value) == false)
            {
                errors.Add(colName, BusinessErrorStrings.User.PhoneNumber_NotE164);
            }



            // duplicate check
            if (errors.Count == 0)       // Perfomance: We check database only if no error is there.
            {
                value = value.ToLower(); // we store all user names in lower case
                CheckUtils.CheckDuplicateValueNotToBeExists(colName, value, idValue, errors, null, fnName == RuleFunctionSEnum.Insert, BusinessErrorStrings.User.PhoneNumber_DuplicatePhoneNumber);
            }

            if (errors.Count > 0 && throwIfErrors)
            {
                throw new BRException(errors);
            }

            return(errors.Count == 0);
        }
Example #9
0
        public void ValidateEmailTest4()
        {
            UserBR                target  = CreateNewUserBR();
            string                value   = "ایمیلدرزباندیگر@دامینزباندیگر.کام";
            Nullable <long>       idValue = null;
            BusinessRuleErrorList errors  = new BusinessRuleErrorList();
            RuleFunctionSEnum     fnName  = RuleFunctionSEnum.Insert;
            bool throwIfErrors            = false;
            bool actual   = target.ValidateEmail(value, idValue, errors, fnName, throwIfErrors);
            bool expected = true;

            Assert.AreEqual(expected, actual);
        }
Example #10
0
        public override string ToString()
        {
            string msg = base.ToString();

            BusinessRuleErrorList errors = this.RuleErrors;

            foreach (BusinessRuleError err in errors)
            {
                msg += err.ColumnTitle + ":" + err.ErrorDescription + "\r\n";
            }

            return(msg);
        }
Example #11
0
        public void ValidateUserNameTest2()
        {
            UserBR                target  = CreateNewUserBR();
            string                value   = TestUtils.RandomUtils.RandomUserName();
            Nullable <long>       idValue = null;
            BusinessRuleErrorList errors  = new BusinessRuleErrorList();
            RuleFunctionSEnum     fnName  = RuleFunctionSEnum.Insert;
            bool throwIfErrors            = false;
            bool actual   = target.ValidateUserName(value, idValue, errors, fnName, throwIfErrors);
            bool expected = true;

            Assert.AreEqual(expected, actual);
        }
Example #12
0
        public void ValidateUserNameTest5()
        {
            UserBR                target  = CreateNewUserBR();
            string                value   = "testExistingUserName";
            Nullable <long>       idValue = 1;
            BusinessRuleErrorList errors  = new BusinessRuleErrorList();
            RuleFunctionSEnum     fnName  = RuleFunctionSEnum.Update;
            bool throwIfErrors            = false;
            bool actual   = target.ValidateUserName(value, idValue, errors, fnName, throwIfErrors);
            bool expected = true;

            Assert.AreEqual(expected, actual);
        }
Example #13
0
        public void ValidateUserNameTest9()
        {
            UserBR target = CreateNewUserBR();
            BusinessRuleErrorList errors = new BusinessRuleErrorList();
            RuleFunctionSEnum     fnName = RuleFunctionSEnum.Insert;
            bool throwIfErrors           = true;

            for (int i = 0; i < 100; i++)
            {
                string userName = TestUtils.RandomUtils.RandomUserName();
                target.ValidateUserName(userName, null, errors, fnName, throwIfErrors);
            }
        }
Example #14
0
        //Please write your properties and functions here. This part will not be replaced.


        public override void CheckRules(object entitySet, RuleFunctionSEnum fnName, BusinessRuleErrorList errors)
        {
            if (fnName == RuleFunctionSEnum.Update)
            {
                //var foodGroupId = FWUtils.EntityUtils.GetObjectFieldValue(entitySet, vFoodGroup.ColumnNames.FoodGroupID);
                //var groupService = UTD.Tricorder.Common.EntityInfos.FoodGroupItemEN.GetService();
                //var itemsCount = groupService.GetCount(new FilterExpression(vFoodGroupItem.ColumnNames.FoodGroupID, foodGroupId));
                //if (itemsCount == 0)
                //{
                //    errors.Add(new BusinessRuleError(){ ColumnName="", ColumnTitle="", ErrorDescription= BusinessErrorStrings.FoodGroup.NotItemInFoodGroup});
                //}
            }
        }
Example #15
0
        public void ValidateEmailTest2()
        {
            UserBR                target  = CreateNewUserBR();
            string                value   = "testemailstringwithoutdomain";
            Nullable <long>       idValue = null;
            BusinessRuleErrorList errors  = new BusinessRuleErrorList();
            RuleFunctionSEnum     fnName  = RuleFunctionSEnum.Insert;
            bool throwIfErrors            = false;
            bool actual   = target.ValidateEmail(value, idValue, errors, fnName, throwIfErrors);
            bool expected = false;

            Assert.AreEqual(expected, actual);
        }
Example #16
0
        public void ValidateEmailTest6()
        {
            UserBR                target  = CreateNewUserBR();
            string                value   = "*****@*****.**";
            Nullable <long>       idValue = 2;
            BusinessRuleErrorList errors  = new BusinessRuleErrorList();
            RuleFunctionSEnum     fnName  = RuleFunctionSEnum.Update;
            bool throwIfErrors            = false;
            bool actual   = target.ValidateEmail(value, idValue, errors, fnName, throwIfErrors);
            bool expected = false;

            Assert.AreEqual(expected, actual);
        }
Example #17
0
        public bool RegisterAndLogin(RegisterInfoOffsite p, BusinessRuleErrorList errors, bool throwIfException)
        {
            //ValidatePassword(p.Password, errors, false);
            //ValidateUserName(p.UserName, null, errors, RuleFunctionSEnum.Insert, false);
            ValidateEmail(p.Email, null, errors, RuleFunctionSEnum.Insert, false);
            ValidatePhoneNumber(p.PhoneNumber, null, true, errors, RuleFunctionSEnum.Insert, false);

            if (errors.Count > 0 && throwIfException)
            {
                throw new BRException(errors);
            }

            return(errors.Count == 0);
        }
        //Please write your properties and functions here. This part will not be replaced.

        public override void CheckRules(object entitySet, RuleFunctionSEnum fnName, BusinessRuleErrorList errors)
        {
            base.CheckRules(entitySet, fnName, errors);

            // check to make sure that no duplicate item is exists in the database
            CheckUtils.CheckDuplicateTwoKeyNotToBeExists(entitySet,
                                                         vDoctor_Specialty.ColumnNames.SpecialtyID,
                                                         vDoctor_Specialty.ColumnNames.DoctorID,
                                                         vDoctor_Specialty.ColumnNames.Doctor_SpecialtyID,
                                                         errors,
                                                         null,
                                                         fnName == RuleFunctionSEnum.Insert,
                                                         null);
        }
Example #19
0
        public void ValidateUserNameTest3()
        {
            // we want to change a user name of a registered existing id value
            UserBR                target  = CreateNewUserBR();
            string                value   = TestUtils.RandomUtils.RandomUserName();
            Nullable <long>       idValue = 1;
            BusinessRuleErrorList errors  = new BusinessRuleErrorList();
            RuleFunctionSEnum     fnName  = RuleFunctionSEnum.Update;
            bool throwIfErrors            = false;
            bool actual   = target.ValidateUserName(value, idValue, errors, fnName, throwIfErrors);
            bool expected = true;

            Assert.AreEqual(expected, actual);
        }
Example #20
0
        public void CheckRulesTest2()
        {
            UserBR target = CreateNewUserBR();

            User user = CreateNewUserObject();

            user.Email    = "*****@*****.**";
            user.UserName = "******";

            RuleFunctionSEnum     fnName = RuleFunctionSEnum.Insert;
            BusinessRuleErrorList errors = new BusinessRuleErrorList();

            target.CheckRules(user, fnName, errors);
            Assert.IsTrue(errors.Count > 3);
        }
Example #21
0
        //Please write your properties and functions here. This part will not be replaced.

        public override void CheckRules(object entitySet, RuleFunctionSEnum fnName, BusinessRuleErrorList errors)
        {
            TimeSeriesStrip obj = (TimeSeriesStrip)entitySet;

            if (fnName == RuleFunctionSEnum.Insert)
            {
                obj.EndDateOffset = obj.StartDateOffset;

                CheckUtils.CheckNotEqual(obj.TimeSeriesStripID, Guid.Empty,
                                         vTimeSeriesStrip.ColumnNames.TimeSeriesStripID, errors);

                CheckUtils.CheckNotEqual(obj.TimeSeriesTypeID, 0,
                                         vTimeSeriesStrip.ColumnNames.TimeSeriesTypeID, errors);
            }
        }
        public void InsertDuplicateTest()
        {
            string existingDateTimeInDatabase = "2020-06-25 12:15:00.000";
            var    doctorSchedule             = DoctorScheduleServiceTest.CreateNewDoctorSchedule();

            doctorSchedule.SlotUnixEpoch = DateTimeEpoch.ConvertDateToSecondsEpoch(DateTime.Parse(existingDateTimeInDatabase));
            DoctorScheduleBR      doctorScheduleBR = (DoctorScheduleBR)EntityFactory.GetEntityBusinessRuleByName(vDoctorSchedule.EntityName, "");
            BusinessRuleErrorList errorsList       = new BusinessRuleErrorList();

            doctorScheduleBR.CheckRules(doctorSchedule, RuleFunctionSEnum.Insert, errorsList);
            if (errorsList.Count > 0)
            {
                Assert.AreEqual(BusinessErrorStrings.DoctorSchedule.TimeAllocatedBefore, errorsList[0].ErrorDescription);
            }
            Assert.AreEqual(1, errorsList.Count);
        }
Example #23
0
        public bool ValidateEmail(string value, long?idValue, BusinessRuleErrorList errors, RuleFunctionSEnum fnName, bool throwIfErrors)
        {
            if (string.IsNullOrEmpty(value))
            {
                return(true);
            }
            //if (CheckUtils.CheckStringShouldNotBeNullOrEmpty(vUser.ColumnNames.Email, value, errors) == false)
            //    if (throwIfErrors)
            //        throw new BRException(errors);
            //    else
            //        return false;


            if (fnName == RuleFunctionSEnum.Delete)
            {
                return(true);
            }

            string colName = vUser.ColumnNames.Email;

            // format check
            // we try to create a mail address. If format was incorrect then its an error
            //http://stackoverflow.com/questions/5342375/c-sharp-regex-email-validation
            try
            {
                System.Net.Mail.MailAddress m = new System.Net.Mail.MailAddress(value);
            }
            catch (Exception)
            {
                errors.Add(colName, BusinessErrorStrings.User.Email_InvalidEmailAddress);
            }

            // check duplicate
            if (errors.Count == 0)       // Perfomance: We check database only if no error is there.
            {
                value = value.ToLower(); // we store all emails in lower case
                CheckUtils.CheckDuplicateValueNotToBeExists(colName, value, idValue, errors, null, fnName == RuleFunctionSEnum.Insert, BusinessErrorStrings.User.Email_Duplicate);
            }

            if (errors.Count > 0 && throwIfErrors)
            {
                throw new BRException(errors);
            }

            return(errors.Count == 0);
        }
Example #24
0
        //Please write your properties and functions here. This part will not be replaced.


        public override void CheckRules(object entitySet, RuleFunctionSEnum fnName, BusinessRuleErrorList errors)
        {
            base.CheckRules(entitySet, fnName, errors);

            if (entitySet is Doctor)
            {
                // setting ClinicPhoneSearchable phone
                Doctor obj = (Doctor)entitySet;
                if (fnName != RuleFunctionSEnum.Delete)
                {
                    obj.ClinicPhoneNumberSearchable = UTD.Tricorder.Common.PhoneNumberUtils.MakeSearchablePhoneNumber(obj.ClinicPhoneNumber);
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Example #25
0
        public void UpdatePaykeyInDatabase(string payKey)
        {
            BusinessRuleErrorList errors = new BusinessRuleErrorList();

            if (CheckUtils.CheckStringShouldNotBeNullOrEmpty(vPayment.ColumnNames.PayKey, payKey, errors) == false)
            {
                throw new BRException(errors);
            }

            // check if pay key is not duplicated in database
            FilterExpression filter = new FilterExpression();

            filter.AddFilter(new Filter(vPayment.ColumnNames.PaymentStatusID, (int)EntityEnums.PaymentStatusEnum.PendingWithPayKey));
            if (CheckUtils.CheckDuplicateValueNotToBeExists(vPayment.ColumnNames.PayKey, payKey, null, errors, null, true, null) == false)
            {
                throw new BRException(errors[0].ErrorDescription);
            }
        }
Example #26
0
        public void CopyRange(DoctorScheduleCopyRangeSP p)
        {
            BusinessRuleErrorList errors = new BusinessRuleErrorList();

            if (p.DestinationUnixEpoch > p.SourceUnixEpoch)
            {
                if (p.DestinationUnixEpoch < p.SourceUnixEpoch + (p.NumberOfDays * 86400))
                {
                    throw new BRException(BusinessErrorStrings.DoctorSchedule.CopyOverlapInCopy);
                }
            }
            if (p.SourceUnixEpoch > p.DestinationUnixEpoch)
            {
                if (p.SourceUnixEpoch < p.DestinationUnixEpoch + (p.NumberOfDays * 86400))
                {
                    throw new BRException(BusinessErrorStrings.DoctorSchedule.CopyOverlapInCopy);
                }
            }
        }
Example #27
0
        public bool Register(UserRegisterSP p, BusinessRuleErrorList errors, bool throwIfException)
        {
            if (p.Password != p.ConfirmPassword)
            {
                errors.Add(vUser.ColumnNames.PasswordHash, BusinessErrorStrings.User.PasswordAndConfirmPasswordDoesntMatch);
            }

            ValidatePassword(p.Password, errors, false);
            ValidateUserName(p.UserName, null, errors, RuleFunctionSEnum.Insert, false);
            ValidateEmail(p.Email, null, errors, RuleFunctionSEnum.Insert, false);
            ValidatePhoneNumber(p.PhoneNumber, null, false, errors, RuleFunctionSEnum.Insert, false);

            if (errors.Count > 0 && throwIfException)
            {
                throw new BRException(errors);
            }

            return(errors.Count == 0);
        }
Example #28
0
        /// <summary>
        /// Check business rules for continuing quick registration
        /// </summary>
        /// <param name="p"></param>
        public void ContinueQReg(UserContinueQRegSP p)
        {
            BusinessRuleErrorList errors = new BusinessRuleErrorList();

            if (p.Password != p.ConfirmPassword)
            {
                errors.Add(vUser.ColumnNames.PasswordHash, BusinessErrorStrings.User.PasswordAndConfirmPasswordDoesntMatch);
            }

            CheckUtils.CheckStringShouldNotBeNullOrEmpty(vUser.ColumnNames.Email, p.Email, errors);
            CheckUtils.CheckStringShouldNotBeNullOrEmpty(vUser.ColumnNames.UserName, p.UserName, errors);
            CheckUtils.CheckStringShouldNotBeNullOrEmpty(vUser.ColumnNames.PasswordHash, p.Password, errors);
            CheckUtils.CheckStringShouldNotBeNullOrEmpty(vUser.ColumnNames.PhoneNumber, p.PhoneNumber, errors);

            if (errors.Count > 0)
            {
                throw new BRException(errors);
            }
        }
Example #29
0
        public void ValidateUserNameTest7()
        {
            UserBR target = CreateNewUserBR();
            BusinessRuleErrorList errors = new BusinessRuleErrorList();
            RuleFunctionSEnum     fnName = RuleFunctionSEnum.Insert;
            bool throwIfErrors           = true;

            List <string> validUserNames = new List <string>();

            validUserNames.Add("Mohammad.Ali.Ghaderi");
            validUserNames.Add("Mohammad_Ali_Ghaderi");
            validUserNames.Add("Mohammad1234");
            validUserNames.Add("Mohammad.Ali.Ghaderi");
            validUserNames.Add("testVerylongUsernameWithoutAnySpecialCharacter1234");

            for (int i = 0; i < validUserNames.Count; i++)
            {
                target.ValidateUserName(validUserNames[i], null, errors, fnName, throwIfErrors);
            }
        }
Example #30
0
        public void ValidateUserNameTest4()
        {
            UserBR                target  = CreateNewUserBR();
            string                value   = "testExistingUserName";
            Nullable <long>       idValue = null;
            BusinessRuleErrorList errors  = new BusinessRuleErrorList();
            RuleFunctionSEnum     fnName  = RuleFunctionSEnum.Update;
            bool throwIfErrors            = false;

            try
            {
                bool actual = target.ValidateUserName(value, idValue, errors, fnName, throwIfErrors);
                Assert.AreNotEqual(actual, true);
            }
            catch (Exception)
            {
                Assert.AreEqual(0, errors.Count);
                // if error happened everything is fine
            }
        }