public void AddRentTest() { AddCopyOfBookTest(); AddEmployeeTest(); AddReaderTest(); Assert.AreEqual(0, _dataLayer.GetAllEvents().Count()); List <CopyOfBook> booksForRent = new List <CopyOfBook> { _dataLayer.FindCopyOfBook(c => (c.Book.Name.Equals("Zbrodnia i Kara") && c.PurchaseDate.Year.Equals(2014))), _dataLayer.FindCopyOfBook(c => (c.Book.Name.Equals("Zbrodnia i Kara") && c.PurchaseDate.Year.Equals(2004))) }; Rent rent1 = new Rent(Guid.NewGuid(), _dataLayer.FindReader(r => r.Name.Equals("Adam")), _dataLayer.FindEmployee(e => e.Name.Equals("Katarzyna")), booksForRent, new DateTime(2010, 1, 6, 0, 0, 0)); _dataLayer.AddEvent(rent1); Assert.AreEqual(1, _dataLayer.GetAllEvents().Count()); List <CopyOfBook> booksForRent2 = new List <CopyOfBook> { _dataLayer.GetAllCopiesOfBook().ElementAt(2), _dataLayer.GetAllCopiesOfBook().ElementAt(3), _dataLayer.GetAllCopiesOfBook().ElementAt(4) }; Rent rent2 = new Rent(Guid.NewGuid(), _dataLayer.FindReader(r => r.Name.Equals("Adam")), _dataLayer.FindEmployee(e => e.Name.Equals("Katarzyna")), booksForRent2, new DateTime(2019, 11, 6, 0, 0, 0)); _dataLayer.AddEvent(rent2); Assert.AreEqual(2, _dataLayer.GetAllEvents().Count()); Assert.ThrowsException <ArgumentException>(() => _dataLayer.AddEvent(rent2)); }