Exemplo n.º 1
0
        public async Task GetMeal_ZeroAsId_ShouldReturnBadRequest()
        {
            // Act
            var result = await controller.GetMeal(0);

            // Assert
            Assert.AreEqual(typeof(BadRequestObjectResult), result.Result.GetType());
        }
Exemplo n.º 2
0
        public void ApiGetMealById()
        {
            long            id         = 7;
            var             acc        = Mock.Of <IMealService>(a => a.GetMeal(id) == _sampleMeal1);
            var             uow        = Mock.Of <IUnitOfWork>(u => u.MealService == acc);
            MealsController controller = new MealsController(uow);
            var             response   = controller.GetMeal(id);
            var             result     = response as OkNegotiatedContentResult <MealDto>;
            var             meal       = result.Content;

            Assert.IsTrue(meal.EqualValues(_sampleMeal1));
        }