public void GetOneBeerShouldReturnNotFoundResult() { var catalogMock = new Mock <IBeerCatalog>(); catalogMock.Setup(c => c.FindOneBeerByGuid(It.IsAny <Guid>())).Returns((Guid id) => null); var catalog = catalogMock.Object; var controller = new ApiBeerController(catalog); var result = controller.GetOneBeer(new GetOneBeerRequest { Id = Guid.NewGuid() }); Assert.IsType <NotFoundResult>(result); }
public void GetOneBeerShouldReturnOkObjectResult() { var catalogMock = new Mock <IBeerCatalog>(); catalogMock.Setup(c => c.FindOneBeerByGuid(It.IsAny <Guid>())) .Returns((Guid id) => new Beer(id, "Label", "Description", 0)); var catalog = catalogMock.Object; var controller = new ApiBeerController(catalog); var result = controller.GetOneBeer(new GetOneBeerRequest { Id = Guid.NewGuid() }); Assert.IsType <OkObjectResult>(result); }