Ejemplo n.º 1
0
        public COLResponseModel GetCOLResults(string cityA, string cityB, string salary)
        {
            const string logMethodName = ".GetCOLResults(string cityA, string cityB, string salary) - ";

            _log.Info(logMethodName + "Begin Method");

            COLResponseModel colResponseModel = null;

            //validate fields required for this request.
            COLRequestModel request = new COLRequestModel();

            if (!String.IsNullOrEmpty(cityA))
            {
                request.CityA = Convert.ToInt32(cityA);
            }
            if (!String.IsNullOrEmpty(cityB))
            {
                request.CityB = Convert.ToInt32(cityB);
            }
            if (!String.IsNullOrEmpty(salary))
            {
                request.Salary = Convert.ToDecimal(salary);
            }

            ASAModelValidator mv = new ASAModelValidator();

            string[] fieldNames = { "CityA", "CityB", "Salary" };
            bool     validModel = mv.Validate(request, fieldNames);

            if (validModel)
            {
                try
                {
                    if (_surveyAdapter == null)
                    {
                        _log.Error(logMethodName + _surveyAdapterExceptionMessage);
                        throw new SurveyBadDataException("Null adapter in ASA.Web.Services.SurveyService.GetCOLUrbanAreaList()");
                    }
                    else
                    {
                        COLResponseModel resultsModel = _surveyAdapter.GetCOLResults(request);
                        colResponseModel = resultsModel;
                    }
                }
                catch (Exception ex)
                {
                    _log.Error(logMethodName + "Exception => " + ex.ToString());
                    throw new SurveyOperationException("Web Survey Service - Exception in ASA.Web.Services.SurveyService.GetCOLUrbanAreaList()", ex);
                }
            }
            else
            {
                colResponseModel           = new COLResponseModel();
                colResponseModel.ErrorList = request.ErrorList.ToList();
            }

            _log.Info(logMethodName + "End Method");
            return(colResponseModel);
        }
Ejemplo n.º 2
0
        public void EnrollmentStatus_manageAccount_Test_check_for_string_length_ValidValue()
        {
            ManageAccountModel passingValue = new ManageAccountModel()
            {
                EnrollmentStatus = "P"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(passingValue, "EnrollmentStatus");

            Assert.IsTrue(valid, "Assertion of positive case being true failed");
        }
Ejemplo n.º 3
0
        public void EmailAddressTest_manageAccount_check_for_required_ValidValue()
        {
            ManageAccountModel passingValue = new ManageAccountModel()
            {
                EmailAddress = "*****@*****.**"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(passingValue, "EmailAddress");

            Assert.IsTrue(valid, "Assertion of positive case being true failed");
        }
Ejemplo n.º 4
0
        public void EmailAddressTest_manageAccount_check_for_required_InvalidValue()
        {
            ManageAccountModel invalidValue = new ManageAccountModel()
            {
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(invalidValue, "EmailAddress");

            Assert.IsFalse(valid, "Assertion of negative case being false failed");
            Assert.AreEqual("Email Address is required!", invalidValue.ErrorList[0].BusinessMessage);
        }
Ejemplo n.º 5
0
        public void PasswordTest_manageAccount_check_for_string_length_ValidUpperBoundValue()
        {
            ManageAccountModel passingValueUpperBound = new ManageAccountModel()
            {
                Password = "******"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(passingValueUpperBound, "Password");

            Assert.IsTrue(valid, "Assertion of positive case (upper bound) being true failed");
        }
Ejemplo n.º 6
0
        public void PasswordTest_manageAccount_check_for_password_standards_ASA()
        {
            ManageAccountModel passingValue = new ManageAccountModel()
            {
                Password = "******"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(passingValue, "Password");

            Assert.IsTrue(valid, "Assertion of positive case (1 of 4 attributes) being true failed");
        }
Ejemplo n.º 7
0
        public void YOBTest_manageAccount_check_for_valid_YOB_ValidValue()
        {
            ManageAccountModel passingValue = new ManageAccountModel()
            {
                YOB = (short)(DateTime.Today.Year - 14)
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(passingValue, "YOB");

            Assert.IsTrue(valid, "Assertion of positive case being true failed");
        }
Ejemplo n.º 8
0
        public void EmailAddressTest_manageAccount_check_for_valid_email_ValidValue()
        {
            ManageAccountModel passingValue = new ManageAccountModel()
            {
                EmailAddress = "*****@*****.**"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(passingValue, "EmailAddress");

            Assert.IsTrue(valid, "Assertion of positive case being true failed");
        }
Ejemplo n.º 9
0
        public void EmailAddressTest_manageAccount_check_for_string_length_ValidLowerBoundValue()
        {
            ManageAccountModel passingValueLowerBound = new ManageAccountModel()
            {
                EmailAddress = "*****@*****.**"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(passingValueLowerBound, "EmailAddress");

            Assert.IsTrue(valid, "Assertion of positive case (lower bound) being true failed");
        }
Ejemplo n.º 10
0
        public void PasswordTest_Confirm_manageAccount_check_for_string_length_ValidLowerBoundValue()
        {
            ManageAccountModel passingValueLowerBound = new ManageAccountModel()
            {
                ConfirmPassword = "******"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(passingValueLowerBound, "ConfirmPassword");

            Assert.IsTrue(valid, "Assertion of positive case (lower bound) being true failed");
        }
Ejemplo n.º 11
0
        public void UserName_manageAccount_check_for_string_length_ValidUpperBoundValue()
        {
            ManageAccountModel passingValueUpperBound = new ManageAccountModel()
            {
                UserName = "******"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(passingValueUpperBound, "UserName");

            Assert.IsTrue(valid, "Assertion of positive case (upper bound) being true failed");
        }
Ejemplo n.º 12
0
        public void UserName_manageAccountModel_check_for_valid_username_ValidValue()
        {
            ManageAccountModel passingValue = new ManageAccountModel()
            {
                UserName = "******"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(passingValue, "UserName");

            Assert.IsTrue(valid, "Assertion of positive case being true failed");
        }
Ejemplo n.º 13
0
        public void PasswordTest_New_newpassword_check_for_password_standards_ASA()
        {
            NewPasswordModel passingValue = new NewPasswordModel()
            {
                NewPassword = "******"
            };

            List <ErrorModel> errorList = new List <ErrorModel>();
            ASAModelValidator mv        = new ASAModelValidator();

            bool valid = mv.Validate(passingValue, "NewPassword");

            Assert.IsTrue(valid, "Assertion of positive case being true failed");
        }
Ejemplo n.º 14
0
        public void PasswordTest_New_newpassword_check_for_string_length_ValidLowerBoundValue()
        {
            NewPasswordModel passingValueLowerBound = new NewPasswordModel()
            {
                NewPassword = "******"
            };

            List <ErrorModel> errorList = new List <ErrorModel>();
            ASAModelValidator mv        = new ASAModelValidator();

            bool valid = mv.Validate(passingValueLowerBound, "NewPassword", errorList);

            Assert.IsTrue(valid, "Assertion of positive case (lower bound) being true failed");
        }
Ejemplo n.º 15
0
        public void UserName_logon_check_for_valid_username_ValidValue()
        {
            LogOnModel passingValue = new LogOnModel()
            {
                UserName = "******"
            };

            List <ErrorModel> errorList = new List <ErrorModel>();
            ASAModelValidator mv        = new ASAModelValidator();

            bool valid = mv.Validate(passingValue, "UserName");

            Assert.IsTrue(valid, "Assertion of positive case being true failed");
        }
Ejemplo n.º 16
0
        public void UserName_logon_check_for_string_length_ValidUpperBoundValue()
        {
            LogOnModel passingValueUpperBound = new LogOnModel()
            {
                UserName = "******"
            };

            List <ErrorModel> errorList = new List <ErrorModel>();
            ASAModelValidator mv        = new ASAModelValidator();

            bool valid = mv.Validate(passingValueUpperBound, "UserName", errorList);

            Assert.IsTrue(valid, "Assertion of positive case (upper bound) being true failed");
        }
Ejemplo n.º 17
0
        public void UserName_logon_check_for_required_InvalidValue()
        {
            LogOnModel invalidValue = new LogOnModel()
            {
            };

            List <ErrorModel> errorList = new List <ErrorModel>();
            ASAModelValidator mv        = new ASAModelValidator();

            bool valid = mv.Validate(invalidValue, "UserName", errorList);

            Assert.IsFalse(valid, "Assertion of negative case being false failed");
            Assert.AreEqual("User name is required!", errorList[0].BusinessMessage);
        }
Ejemplo n.º 18
0
        public void UserName_logon_check_for_required_ValidValue()
        {
            LogOnModel passingValue = new LogOnModel()
            {
                UserName = "******"
            };

            List <ErrorModel> errorList = new List <ErrorModel>();
            ASAModelValidator mv        = new ASAModelValidator();

            bool valid = mv.Validate(passingValue, "UserName", errorList);

            Assert.IsTrue(valid, "Assertion of positive case being true failed");
        }
Ejemplo n.º 19
0
        public void PasswordTest_Confirm_newpassword_check_for_string_length_ValidUpperBoundValue()
        {
            NewPasswordModel passingValueUpperBound = new NewPasswordModel()
            {
                ConfirmPassword = "******"
            };

            List <ErrorModel> errorList = new List <ErrorModel>();
            ASAModelValidator mv        = new ASAModelValidator();

            bool valid = mv.Validate(passingValueUpperBound, "ConfirmPassword", errorList);

            Assert.IsTrue(valid, "Assertion of positive case (upper bound) being true failed");
        }
Ejemplo n.º 20
0
        public void EmailTest_forgotpassword_check_for_string_length_ValidUpperBoundValue()
        {
            ForgotPasswordModel passingValueUpperBound = new ForgotPasswordModel()
            {
                Email = "*****@*****.**"
            };

            List <ErrorModel> errorList = new List <ErrorModel>();
            ASAModelValidator mv        = new ASAModelValidator();

            bool valid = mv.Validate(passingValueUpperBound, "Email", errorList);

            Assert.IsTrue(valid, "Assertion of positive case (upper bound) being true failed");
        }
Ejemplo n.º 21
0
        public void UserName_manageAccountModel_check_for_valid_username_InvalidValue()
        {
            ManageAccountModel invalidValue = new ManageAccountModel()
            {
                UserName = "******"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(invalidValue, "UserName");

            Assert.IsFalse(valid, "Assertion of negative case being false failed");
            Assert.AreEqual("Please enter a valid user name.", invalidValue.ErrorList[0].BusinessMessage);
        }
Ejemplo n.º 22
0
        public void UserName_manageAccount_check_for_string_length_InvalidUnderMinValue()
        {
            ManageAccountModel failingValueUnderMin = new ManageAccountModel()
            {
                UserName = "******"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(failingValueUnderMin, "UserName");

            Assert.IsFalse(valid, "Assertion of negative case (under min) being false failed");
            Assert.AreEqual("The UserName must be between 8 and 64 characters long.", failingValueUnderMin.ErrorList[0].BusinessMessage);
        }
Ejemplo n.º 23
0
        public void PasswordTest_Confirm_newpassword_check_for_required_ValidValue()
        {
            NewPasswordModel passingValue = new NewPasswordModel()
            {
                ConfirmPassword = "******"
            };

            List <ErrorModel> errorList = new List <ErrorModel>();
            ASAModelValidator mv        = new ASAModelValidator();

            bool valid = mv.Validate(passingValue, "ConfirmPassword", errorList);

            Assert.IsTrue(valid, "Assertion of positive case being true failed");
        }
Ejemplo n.º 24
0
        public void EmailAddressTest_manageAccount_check_for_valid_email_InvalidValue()
        {
            ManageAccountModel invalidValue = new ManageAccountModel()
            {
                EmailAddress = "failString"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(invalidValue, "EmailAddress");

            Assert.IsFalse(valid, "Assertion of negative case being false failed");
            Assert.AreEqual("Please enter a valid email.", invalidValue.ErrorList[0].BusinessMessage);
        }
Ejemplo n.º 25
0
        public void PasswordTest_Confirm_newpassword_check_for_required_InvalidValue()
        {
            NewPasswordModel invalidValue = new NewPasswordModel()
            {
            };

            List <ErrorModel> errorList = new List <ErrorModel>();
            ASAModelValidator mv        = new ASAModelValidator();

            bool valid = mv.Validate(invalidValue, "ConfirmPassword", errorList);

            Assert.IsFalse(valid, "Assertion of negative case being false failed");
            Assert.AreEqual("Confirm Password is required!", errorList[0].BusinessMessage);
        }
Ejemplo n.º 26
0
        public void YOBTest_manageAccount_check_for_valid_YOB_InvalildValue()
        {
            ManageAccountModel invalildValue = new ManageAccountModel()
            {
                YOB = (short)(DateTime.Today.Year - 32767)
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(invalildValue, "YOB");

            Assert.IsFalse(valid, "Assertion of negative case being false failed");
            Assert.AreEqual("Year of birth is invalid.", invalildValue.ErrorList[0].BusinessMessage);
        }
Ejemplo n.º 27
0
        public void EmailTest_forgotpassword_check_for_valid_email_Valid()
        {
            ForgotPasswordModel passingValue = new ForgotPasswordModel()
            {
                Email = "*****@*****.**"
            };

            List <ErrorModel> errorList = new List <ErrorModel>();
            ASAModelValidator mv        = new ASAModelValidator();

            bool valid = mv.Validate(passingValue, "Email");

            Assert.IsTrue(valid, "Assertion of positive case being true failed");
        }
Ejemplo n.º 28
0
        public void EnrollmentStatus_manageAccount_Test_check_for_string_length_InvalidOverMaxValue()
        {
            ManageAccountModel failingValueOverMax = new ManageAccountModel()
            {
                EnrollmentStatus = "2C"
            };

            ASAModelValidator mv = new ASAModelValidator();

            bool valid = mv.Validate(failingValueOverMax, "EnrollmentStatus");

            Assert.IsFalse(valid, "Assertion of negative case (over max) being false failed");
            Assert.AreEqual("The field Enrollment Status must be a string with a minimum length of 1 and a maximum length of 1.", failingValueOverMax.ErrorList[0].BusinessMessage);
        }
Ejemplo n.º 29
0
        public override bool IsValid()
        {
            bool bIsValid = false;
            var  mv       = new ASAModelValidator();

            bIsValid = base.IsValid();

            if (this.User != null)
            {
                bIsValid &= this.User.IsValid();
            }

            return(bIsValid);
        }
Ejemplo n.º 30
0
        public override bool IsValid()
        {
            bool bIsValid = false;
            var  mv       = new ASAModelValidator();

            bIsValid = base.IsValid();

            if (this._addresses != null)
            {
                foreach (MemberAddressModel pam in this._addresses)
                {
                    bIsValid &= pam.IsValid();
                }
            }

            if (this._emails != null)
            {
                foreach (MemberEmailModel pem in this._emails)
                {
                    bIsValid &= pem.IsValid();
                }
            }

            if (this._phones != null)
            {
                foreach (MemberPhoneModel ppm in this._phones)
                {
                    bIsValid &= ppm.IsValid();
                }
            }

            if (this._schools != null)
            {
                foreach (MemberSchoolModel psm in this._schools)
                {
                    bIsValid &= psm.IsValid();
                }
            }

            if (this._organizations != null)
            {
                foreach (MemberOrganizationModel pom in this._organizations)
                {
                    bIsValid &= pom.IsValid();
                }
            }

            return(bIsValid);
        }