Validate() public method

public Validate ( Interviewer interviewer ) : void
interviewer Nfield.Models.Interviewer
return void
        public void TestValidate_InterviewerEmailAddressLengthMoreThanFifty_ThrowsValidationMetadataException()
        {
            var EmailAddressString =
                "Lorem ipsum dolor sit amet, te est tollit definiebas, ullum appareat adversarium an usu. Offendit";
            var stubInterviewer = new Interviewer()
                {
                    UserName = "******",
                    Password = "******",
                    FirstName = "firstname",
                    LastName = "lastname",
                    EmailAddress = EmailAddressString
                };

            var validator = new CustomInterviewerValidatorAttribute();

            var ex = Assert.Throws<ValidationMetadataException>(() => validator.Validate(stubInterviewer));
            Assert.True(ex.Message.Contains("maximum length"));
            Assert.True(ex.Message.Contains("EmailAddress"));
        }
        public void TestValidate_InterviewerClientInterviewerIdLengthMoreThanEight_ThrowsValidationMetadataException()
        {
            var ClientInterviewerIdString =
                "MoreThan8Characters";
            var stubInterviewer = new Interviewer()
            {
                UserName = "******",
                Password = "******",
                FirstName = "firstname",
                LastName = "lastname",
                EmailAddress = "*****@*****.**",
                TelephoneNumber = "TelephoneNumber",
                ClientInterviewerId = ClientInterviewerIdString
            };

            var validator = new CustomInterviewerValidatorAttribute();

            var ex = Assert.Throws<ValidationMetadataException>(() => validator.Validate(stubInterviewer));
            Assert.True(ex.Message.Contains("ClientInterviewerId"));
        }
        public void TestValidate_InterviewerIsNull_ThrowsValidationMetadataException()
        {
            Interviewer stubInterviewer = null;

            var validator = new CustomInterviewerValidatorAttribute();

            Assert.Throws<ValidationMetadataException>(() => validator.Validate(stubInterviewer));
        }
        public void TestValidate_InterviewerUserNameLengthMoreThanFifty_ThrowsValidationMetadataException()
        {
            var userNameString =
                "Lorem ipsum dolor sit amet, te est tollit definiebas, ullum appareat adversarium an usu. Offendit";
            var stubInterviewer = new Interviewer() { UserName = userNameString };

            var validator = new CustomInterviewerValidatorAttribute();

            var ex = Assert.Throws<ValidationMetadataException>(() => validator.Validate(stubInterviewer));
            Assert.True(ex.Message.Contains("maximum length"));
            Assert.True(ex.Message.Contains("UserName"));
        }
        public void TestValidate_InterviewerUserNameIsNull_ThrowsValidationMetadataException()
        {
            var stubInterviewer = new Interviewer(){UserName = null};

            var validator = new CustomInterviewerValidatorAttribute();

            var ex = Assert.Throws<ValidationMetadataException>(() => validator.Validate(stubInterviewer));
            Assert.True(ex.Message.Contains("Required"));
        }
        public void TestValidate_InterviewerTelephoneNumberLengthMoreThanThirty_ThrowsValidationMetadataException()
        {
            var TelephoneNumberString =
                "Lorem ipsum dolor sit amet, te est";
            var stubInterviewer = new Interviewer()
            {
                UserName = "******",
                Password = "******",
                FirstName = "firstname",
                LastName = "lastname",
                EmailAddress = "*****@*****.**",
                TelephoneNumber = TelephoneNumberString
            };

            var validator = new CustomInterviewerValidatorAttribute();

            var ex = Assert.Throws<ValidationMetadataException>(() => validator.Validate(stubInterviewer));
            Assert.True(ex.Message.Contains("maximum length"));
            Assert.True(ex.Message.Contains("TelephoneNumber"));
        }