public void ValidateYearEmpty() { string year = ""; bookValidator.ValidateYear(year); Assert.AreEqual(TestResult, bookValidator.Result); }
public IActionResult AddBook(BookView bookView) { if (bookValidator.ValidateISBN(bookView.ISBN) && bookValidator.ValidateTitle(bookView.Title) && bookValidator.ValidateCategory(bookView.Category) && bookValidator.ValidateYear(bookView.Year_of_publication) && bookValidator.ValidateAuthor(bookView.author.Firstname)) { Book book = BookViewToBook(bookView); bookContainer.AddBook(book); ModelState.AddModelError("Succes", "Boek is toegevoegd"); return(View("BookToevoegen")); } else { ModelState.AddModelError("Alert", bookValidator.Result); return(View("BookToevoegen")); } }