public void GetAllBeersShouldReturnNoContentResult() { var catalogMock = new Mock <IBeerCatalog>(); catalogMock.Setup(c => c.FindAllBeers()) .Returns(() => new List <Beer>().AsQueryable()); var catalog = catalogMock.Object; var controller = new ApiBeerController(catalog); var result = controller.GetAllBeers(new GetAllBeersRequest { Page = 1, PerPage = 50 }); Assert.IsType <NoContentResult>(result); }
public void GetAllBeersShouldReturnOkObjectResult() { var catalogMock = new Mock <IBeerCatalog>(); catalogMock.Setup(c => c.FindAllBeers()).Returns(() => new List <Beer> { new Beer(Guid.NewGuid(), "Label", "Description", 0) }.AsQueryable() ); var catalog = catalogMock.Object; var controller = new ApiBeerController(catalog); var result = controller.GetAllBeers(new GetAllBeersRequest { Page = 1, PerPage = 50 }); Assert.IsType <OkObjectResult>(result); }