예제 #1
0
        public static void Validate_OdsCodeIsValid_DoesNotHaveError(
            ServiceRecipientModelValidator validator)
        {
            var model = new ServiceRecipientModel {
                OdsCode = new string('1', 8)
            };

            var result = validator.TestValidate(model);

            result.ShouldNotHaveValidationErrorFor(m => m.OdsCode);
        }
예제 #2
0
        public static void Validate_OdsCodeIsTooLong_HasError(
            ServiceRecipientModelValidator validator)
        {
            var model = new ServiceRecipientModel {
                OdsCode = new string('1', 9)
            };

            var result = validator.TestValidate(model);

            result
            .ShouldHaveValidationErrorFor(m => m.OdsCode)
            .WithErrorMessage($"{nameof(ServiceRecipientModel.OdsCode)}TooLong");
        }
예제 #3
0
        public static void Validate_OdsCodeIsEmpty_HasError(
            string odsCode,
            ServiceRecipientModelValidator validator)
        {
            var model = new ServiceRecipientModel {
                OdsCode = odsCode
            };

            var result = validator.TestValidate(model);

            result
            .ShouldHaveValidationErrorFor(m => m.OdsCode)
            .WithErrorMessage($"{nameof(ServiceRecipientModel.OdsCode)}Required");
        }