Пример #1
0
        public void ShouldBeValidIfUkprnSpecified()
        {
            var vm = new ConfirmTrainingProviderEditModel
            {
                Ukprn = "12345678"
            };

            var validator = new ConfirmTrainingProviderEditModelValidator();

            var result = validator.Validate(vm);

            result.IsValid.Should().BeTrue();
        }
Пример #2
0
        public void ShouldErrorIfUkprnIsInvalid()
        {
            var vm = new ConfirmTrainingProviderEditModel {
                Ukprn = "invalid ukprn"
            };

            var validator = new ConfirmTrainingProviderEditModelValidator();

            var result = validator.Validate(vm);

            result.IsValid.Should().BeFalse();
            result.Errors.Count.Should().Be(1);
            result.Errors[0].PropertyName.Should().Be("Ukprn");
            result.Errors[0].ErrorMessage.Should().Be("UKPRN is not recognised");
        }
Пример #3
0
        public void ShouldErrorIfUkprnIsNotSpecified(string inputUkprn)
        {
            var vm = new ConfirmTrainingProviderEditModel
            {
                Ukprn = inputUkprn
            };

            var validator = new ConfirmTrainingProviderEditModelValidator();

            var result = validator.Validate(vm);

            result.IsValid.Should().BeFalse();
            result.Errors.Count.Should().Be(1);
            result.Errors[0].PropertyName.Should().Be("Ukprn");
            result.Errors[0].ErrorMessage.Should().Be("The UKPRN field is required");
        }