示例#1
0
        public void GetById_return_user_null()
        {
            IConsumedFoods        consumedFoods = GetConsumedFoods();
            ConsumedFoodsResponse response      = consumedFoods.GetByUser("NonExistenUser");

            Assert.IsTrue(response.IsValid);
            Assert.IsTrue(response.ConsumedFood.Count < 1);
        }
示例#2
0
        public void GetByUser_return_valid_user()
        {
            IConsumedFoods        consumedFoods = GetConsumedFoods();
            ConsumedFoodsResponse response      = consumedFoods.GetByUser("RegisteredUserId");

            Assert.IsTrue(response.IsValid);
            Assert.IsTrue((response.ConsumedFood.Count > 0));
        }
 public IActionResult GetByUser(string userId)
 {
     try
     {
         response = _responseHandler.ProcessResponse(_consumedFoods.GetByUser(userId));
     }
     catch (Exception exception)
     {
         response = new BadRequestObjectResult(exception);
     }
     return(response);
 }