-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some restrictions are added to the model Book #11
Conversation
Perfecto. Necesitamos tests que validen estas reglas |
Aquí un ejemplo: |
…Book. Tambien valida cuando un ISBN tiene mas de trece digitos
Se que los tests sobre un campo nulo se pueden reducir usando lo que en NUnit se llama |
Carajo, se me va salir una lagrima (de felicidad) 🙃 |
Mañana le doy Merge q toy echao! |
@@ -25,7 +26,86 @@ public void BookHasNecessaryProperties() | |||
ISBN = "020161622X", | |||
CoverUrl = "https://images-na.ssl-images-amazon.com/images/I/41BKx1AxQWL._SX258_BO1,204,203,200_.jpg" | |||
}; | |||
var ValidationResult = new List<ValidationResult>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about create a method to encapsulate this validation, so you don't have to repeat these lines only the method.
This is great. I have an idea though, what if we had validations happen in the outermost layer of the application. In this case, I'm thinking in a "viewmodel" or something like that. The benefits that we would achieve from that is we could add internationalization easily from the UI/Web component, and keep invalid input from reaching the internals of the application. what do you think? @amhed @willjobs @NestorEduardo |
public string CoverUrl { get; set; } | ||
|
||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this being used?
One thing at a time @esanmiguelc. This is great =D |
Could we keep the commits to a single language? either spanish or english for consistency |
@esanmiguelc totally agree and I prefer English, Is the most used in this area (Software development). |
… I also added a message indicating what the test result must return
@NestorEduardo update the names on the tests and I'll merge this asap |
I'm sorry for the delay |
Some restrictions added so that the fields are mandatory. The ISBN can not be more than thirteen numbers.