Ejemplo 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.GiveBook(5, null));
        }
Ejemplo 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.GiveBook(1, 1));
        }