public void ShouldGetAllSnacks() { //Arrange Snack snack = new Snack { imageURL = "testUrl", Name = "testName" }; applicationDbContext.Snacks.Add(snack); applicationDbContext.SaveChanges(); //Act List <Snack> snacks = snackService.GetAllSnacks(); //Assert Assert.Single(snacks); Assert.Equal(snack.imageURL, snacks[0].imageURL); Assert.Equal(snack.Name, snacks[0].Name); }
public ActionResult <List <Snack> > GetAllSnacks() { return(Ok(snackService.GetAllSnacks())); }
public async Task <ActionResult <IEnumerable <SnackOutput> > > Get() { var snacks = await _snackService.GetAllSnacks(); return(Ok(snacks)); }