Пример #1
0
        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);
        }
Пример #2
0
 public ActionResult <List <Snack> > GetAllSnacks()
 {
     return(Ok(snackService.GetAllSnacks()));
 }
Пример #3
0
        public async Task <ActionResult <IEnumerable <SnackOutput> > > Get()
        {
            var snacks = await _snackService.GetAllSnacks();

            return(Ok(snacks));
        }