public void GetId_ReturnsTrue_IfNull()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         BookServiceMock.DefaultValueProvider = null;
     });
     var operation = new GetBookIdOperation(BookServiceMock.Object);
 }
        public ActionResult <Book> Get(string id)
        {
            var operation = new GetBookIdOperation(_bookService);
            var result    = operation.GetBookId(id);

            if (operation == null)
            {
                return(NotFound());
            }

            return(result);
        }
        public void GetId_ReturnsTrue_IfItIsNotEmpty()
        {
            //Arrange
            BookServiceMock.Setup(p => p.Get(It.IsAny <string>())).Returns(new Book {
                Id = "3", Price = 5, Author = "Robert"
            });
            Book book      = new Book();
            var  operation = new GetBookIdOperation(BookServiceMock.Object);
            //Act
            var result = operation.GetBookId("3");

            //Assert
            Assert.NotEmpty(result.Author);
        }
        public void GetId_ReturnsTrue_IfItIsNull()
        {
            //Arrange
            BookServiceMock.Setup(p => p.Get(It.IsAny <string>())).Returns(new Book {
                Price = It.IsAny <decimal>()
            });
            Book book      = new Book();
            var  operation = new GetBookIdOperation(BookServiceMock.Object);
            //Act
            var result = operation.GetBookId(It.IsAny <string>());

            //Assert
            Assert.Null(result.Author);
        }