Пример #1
0
        public void DeleteBookCopyConsistencyTest()
        {
            Assert.AreEqual(repository.GetAllBookCopies().Count(), 5);
            repository.DeleteBookCopy(repository.GetBookCopy(0));
            Assert.AreEqual(repository.GetAllBookCopies().Count(), 5);

            var book = new BookCopy(repository.GetBookDescription("Metro 2033"), new DateTime(1989, 2, 5), "7658484876543");

            repository.AddBookCopy(book);
            Assert.AreEqual(repository.GetAllBookCopies().Count(), 6);
            repository.DeleteBookCopy(book);
            Assert.AreEqual(repository.GetAllBookCopies().Count(), 5);
        }
Пример #2
0
 public void DeleteBookCopy(string isbn)
 {
     foreach (var bookCopy in _dataRepository.GetAllBookCopies())
     {
         if (bookCopy.Isbn.Equals(isbn))
         {
             _dataRepository.DeleteBookCopy(bookCopy);
             return;
         }
     }
 }