public void AddCopyOfBookTest() { AddBookTest(); CopyOfBook cob1 = new CopyOfBook(Guid.NewGuid(), _dataLayer.FindBook(b => b.Name.Equals("Zbrodnia i Kara")), new DateTime(2004, 12, 3, 0, 0, 0), 0.6); CopyOfBook cob2 = new CopyOfBook(Guid.NewGuid(), _dataLayer.FindBook(b => b.Name.Equals("Zbrodnia i Kara")), new DateTime(2014, 12, 3, 0, 0, 0), 0.6); Assert.AreNotEqual(cob1, cob2); Assert.AreEqual(0, _dataLayer.GetAllCopiesOfBook().Count()); _dataLayer.AddCopyOfBook(cob1); Assert.AreEqual(1, _dataLayer.GetAllCopiesOfBook().Count()); _dataLayer.AddCopyOfBook(cob2); Assert.AreEqual(2, _dataLayer.GetAllCopiesOfBook().Count()); Assert.ThrowsException <ArgumentException>(() => _dataLayer.AddCopyOfBook(cob1)); CopyOfBook zik1 = new CopyOfBook(Guid.NewGuid(), _dataLayer.GetAllBooks().ElementAt(0), new DateTime(2001, 10, 11, 0, 0, 0), 0.5); CopyOfBook zik2 = new CopyOfBook(Guid.NewGuid(), _dataLayer.GetAllBooks().ElementAt(0), new DateTime(2002, 10, 11, 0, 0, 0), 0.5); CopyOfBook wp1 = new CopyOfBook(Guid.NewGuid(), _dataLayer.GetAllBooks().ElementAt(0), new DateTime(2005, 12, 23, 0, 0, 0), 0.7); _dataLayer.AddCopyOfBook(zik1); _dataLayer.AddCopyOfBook(zik2); _dataLayer.AddCopyOfBook(wp1); Assert.AreEqual(5, _dataLayer.GetAllCopiesOfBook().Count()); }