public ActionResult <List <Book> > Get() { var operation = new GetBookOperation(_bookService); var result = operation.GetBooks(); return(result); }
public void Get_ReturnsTrue_IfResultNotEmpty() { //Arrange BookServiceMock.Setup(x => x.Get()).Returns(new List <Book> { new Book { Id = It.IsIn <string>() } }); var operation = new GetBookOperation(BookServiceMock.Object); //Act var result = operation.GetBooks(); //Assert Assert.NotEmpty(result); }
public void Get_ReturnsTrue_IfTheCollectionIsNotEmpty() { //Arrange BookServiceMock.Setup(x => x.Get()).Returns(new List <Book> { new Book { Author = It.IsAny <string>() } }); var operation = new GetBookOperation(BookServiceMock.Object); //Act var result = operation.GetBooks(); //Assert Assert.NotEmpty(result); BookServiceMock.Verify(x => x.Get(), Times.Once); }