Пример #1
0
        public void ShouldNotHaveErrorsOnSendWhenFilled()
        {
            const string aString = "SomeString";
            const string anEmail = "*****@*****.**";

            var viewModel = new ContactMessageViewModel
            {
                Name    = aString,
                Email   = anEmail,
                Enquiry = aString
            };

            var viewModelValidator = new ContactMessageClientViewModelValidator();

            viewModelValidator.ShouldNotHaveValidationErrorFor(x => x.Details, viewModel);
            viewModelValidator.ShouldNotHaveValidationErrorFor(x => x.Name, viewModel);
            viewModelValidator.ShouldNotHaveValidationErrorFor(x => x.Enquiry, viewModel);
            viewModelValidator.ShouldNotHaveValidationErrorFor(x => x.Email, viewModel);
        }
Пример #2
0
        public void ShouldHaveErrorsOnSendWhenBlank()
        {
            var viewModel          = new ContactMessageViewModel();
            var viewModelValidator = new ContactMessageClientViewModelValidator();

            viewModelValidator.ShouldNotHaveValidationErrorFor(x => x.Details, viewModel);
            viewModelValidator.ShouldHaveValidationErrorFor(x => x.Name, viewModel);
            viewModelValidator.ShouldHaveValidationErrorFor(x => x.Enquiry, viewModel);
            viewModelValidator.ShouldHaveValidationErrorFor(x => x.Email, viewModel);
        }