public void BookIdIsNull() { // Arrange var mock = new Mock <IUnitOfWork>(); LibService service = new LibService(mock.Object); // Act and assert Assert.ThrowsException <System.ArgumentNullException>(() => service.GiveBook(5, null)); }
public void BookIsNotFound() { // Arrange var mock = new Mock <IUnitOfWork>(); mock.Setup(a => a.Books.Get(1)).Returns((Book)null); mock.Setup(a => a.Readers.Get(1)).Returns(new Reader()); LibService service = new LibService(mock.Object); // Act and assert Assert.ThrowsException <System.InvalidOperationException>(() => service.GiveBook(1, 1)); }