Exemplo n.º 1
0
 public ViewResult RegBookForm(Book book)
 {
     if (ModelState.IsValid)
     {
         BookRepository.AddResponse(book);
         return(View("Thanks", book));
     }
     else
     {
         // Hay un error de validacion y retornamos una vista en blanco.
         return(View());
     }
 }
Exemplo n.º 2
0
        public void NewBook_ShouldBeAdded()
        {
            //Arrange
            Book newBook = new Book()
            {
                Title = "Title 1", Author = "Author1", ISBN = "ISBN1", NroPages = 200, Price = 100
            };

            //Act
            BookRepository.AddResponse(newBook);
            //Assert
            Assert.Equal("Title 1", BookRepository.Books.FirstOrDefault().Title);
        }