Example #1
0
        public void ValidateIngredientsReturnsError_IfSizeId_DoesntMach()
        {
            var size        = new Size(1, Position.Create(new DTO.Position(1, "1", "1")));
            var ingredient  = new DTOIngredient(1, 1, new DTOSize(2, "1", new Money(), new DTO.Position(1, "1", "1")), new DTO.Consumable(1, "1", 0));
            var ingredients = new List <DTOIngredient>()
            {
                ingredient
            };

            var list = size.ValidateIngredients(ingredients, out var error);

            Assert.AreEqual("Ingredient 1 corresponds to another size /n", error);
            Assert.AreEqual(0, list.Count);
        }
Example #2
0
        public void ValidateIngredientsReturnsError_IfConsumableRepeat()
        {
            var size        = new Size(1, Position.Create(new DTO.Position(1, "1", "1")));
            var ingredient1 = new DTOIngredient(1, 1, new DTOSize(1, "1", new Money(), new DTO.Position(1, "1", "1")), new DTO.Consumable(1, "1", 0));
            var ingredient2 = new DTOIngredient(2, 1, new DTOSize(1, "1", new Money(), new DTO.Position(1, "1", "1")), new DTO.Consumable(1, "1", 0));
            var ingredients = new List <DTOIngredient>()
            {
                ingredient1, ingredient2
            };

            var list = size.ValidateIngredients(ingredients, out string error);

            Assert.AreEqual("Ingredient 1 is already present /n", error);
            Assert.AreEqual(1, list.Count);
        }