Ejemplo n.º 1
0
        public void when_ingredient_not_exists_adds_new_ingredient()
        {
            var ingredient = new Ingredient {
                Name = "Pepper", Stock = 20, UnitMeasure = UnitMeasure.Unit
            };

            _mockIngredientRepository.Setup(m => m.ExistsByName(ingredient.Name)).Returns(false);

            _restaurant.AddIngredient(ingredient);

            _mockIngredientRepository.Verify(m => m.Add(ingredient), Times.Once);
            _mockIngredientRepository.Verify(m => m.FindByName(ingredient.Name), Times.Never);
            _mockIngredientRepository.Verify(m => m.Update(It.IsAny <int>(), It.IsAny <Ingredient>()), Times.Never);
        }
Ejemplo n.º 2
0
        public void AddNewIngredientWithZeroQuantity()
        {
            var restaurant = new Restaurant();
            var detail     = new ProductDetail(id: 1, nameProduct: "Salchicha", cost: 1000m, quantity: 0);
            var result     = restaurant.AddIngredient(new Ingredient(detail));

            Assert.AreEqual("Se necesita una cantidad mayor a 0", result);
        }
Ejemplo n.º 3
0
        public void AddNewIngredient()
        {
            var restaurant = new Restaurant();
            var detail     = new ProductDetail(id: 1, nameProduct: "Salchicha", cost: 1000m, quantity: 1);
            var result     = restaurant.AddIngredient(new Ingredient(detail));

            Assert.AreEqual("Se agrego el ingrediente correctamente", result);
        }