Ejemplo n.º 1
0
        public void InsertTest()
        {
            // Arrange
            UserController controlleru = new UserController();
            // Act
            List <User> loadAllU = controlleru.Get() as List <User>;
            //grab first result
            User u = loadAllU[0];

            // Arrange
            FoodController controllerf = new FoodController();
            // Act
            List <Food> loadAllF = controllerf.Get() as List <Food>;

            Meal m = new Meal {
                UserId = u.Id, Description = "Breakfast", FoodItems = loadAllF, Time = System.DateTime.Now
            };


            // Arrange
            MealController controller = new MealController();

            // Act
            int result = controller.Post(m);

            // Assert
            Assert.IsTrue(result > 0);
        }
        public async Task FoodControllerTest()
        {
            FoodController foodController = new FoodController();
            var            foodList       = await foodController.Get();

            Assert.NotNull(foodList);
            Assert.Equal(5, foodList.Count);
        }
Ejemplo n.º 3
0
        public void LoadTest()
        {
            // Arrange
            FoodController controller = new FoodController();

            // Act
            IEnumerable <Food> result = controller.Get() as IEnumerable <Food>;

            // Assert
            Assert.IsNotNull(result);
        }
Ejemplo n.º 4
0
        public void UpdateTest()
        {
            // Arrange
            FoodController controller = new FoodController();

            // Act
            List <Food> loadAll = controller.Get() as List <Food>;

            //grab first result
            Food f = loadAll[0];

            f.Quantity = 100;

            int results = controller.Post(f);

            Assert.IsTrue(results > 0);
        }
Ejemplo n.º 5
0
        public void DeleteTest()
        {
            //always fails because There is a workout that depends on this Foodtype


            // Arrange
            FoodController controller = new FoodController();

            // Act
            List <Food> loadAll = controller.Get() as List <Food>;

            //grab first result
            Food f = loadAll[0];

            int results = controller.Delete(f);

            Assert.IsTrue(results > 0);
        }