Esempio n. 1
0
        public void BookIdIsNull()
        {
            // Arrange
            var        mock    = new Mock <IUnitOfWork>();
            LibService service = new LibService(mock.Object);

            // Act and assert
            Assert.ThrowsException <System.ArgumentNullException>(() => service.ReturnBook(5, null));
        }
Esempio n. 2
0
        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.ReturnBook(1, 1));
        }