public BookRisultatiViewModel(Book libro) { Repository repo = new Repository(); __book = libro; books = repo.FindByTitle(libro.Title).ToList(); booksAutori = repo.FindByAuthor(libro.Author).ToList(); }
public void Add_ShouldAddBook() { var libro = new Book { Id = ObjectId.Parse("564b0c119028881324c2b115"), Title = Title1, Author = "gigi l'autore", ISBN = "123456789", Publisher = "editor" }; _repository.Add(libro); Assert.That(true, libro.Title = Title1); }
public void FindBooksByAuthor() { var expectedBook2 = new Book { Author = Author, Title = Title2, Publisher = Publisher, }; var books = _repository.FindByAuthor(Author).OrderBy(x => x.Title).ToList(); Assert.AreEqual(5, books.Count); var foundBook = books[0]; Assert.AreNotSame(_expectedBook, foundBook); foundBook = books[1]; Assert.AreNotSame(expectedBook2, foundBook); }
public ActionResult AggiuntaLibro(Book book) { _repo.Add(book); return RedirectToAction("Index"); }
public ActionResult SalvaModifiche(string id, string titolo, string autore, string isbn, string publisher) { Book libro = new Book(); libro.Id = ObjectId.Parse(id); libro.Title = titolo; libro.Author = autore; libro.ISBN = isbn; libro.Publisher = publisher; _repo.Update(libro); return RedirectToAction("Index"); }
public void Update(Book book) { mongoColl.Save(book); }
public void Add(Book book) { mongoColl.Insert(book); }
public void Setup() { _expectedBook = new Book { Author = Author, Title = Title1, Publisher = Publisher, ISBN = Isbn }; _differentBook = new Book { Author = Author + " Different", Title = Title1 + "Different", Publisher = (Publisher + "Different"), ISBN = Isbn + "Different", }; mongoC = new MongoClient(); _mongoDatabase = mongoC.GetDatabase("BookMVC"); mongodb = mongoC.GetServer().GetDatabase("BookMVC"); mongoColl = mongodb.GetCollection<Book>("BookTest"); _bookCollection = _mongoDatabase.GetCollection<Book>("BookTest"); _repository = new Repository(_mongoDatabase); }