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); }
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"); }
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"); }