Beispiel #1
0
 public void UpdateSizes(ICollection <DTOSize> sizes, ICollection <Consumable> consumables)
 {
     this.sizes.Clear();
     sizes = ValidateSizes(sizes, out _);
     foreach (var dtoSize in sizes)
     {
         var size = new Size(dtoSize.Id, this);
         size.UpdateSize(dtoSize);
         size.UpdateIngredients(dtoSize.Ingredients, consumables);
         this.sizes.Add(size);
     }
 }
Beispiel #2
0
        public void UpdateIngredientsTest()
        {
            var consumables = new List <Model.Consumable>()
            {
                new Model.Consumable(1)
            };
            var size          = new Size(1, new PositionStub(1, "1", "1"));
            var dtoIngredient = new DTOIngredient(1, 0, new DTO.Size(1, "size1", new Money(1), new DTO.Position(1, "1", "1")), new DTO.Consumable(1, "water", 0));
            var ingredients   = new List <DTOIngredient> {
                dtoIngredient
            };
            var domainIngredient = new Ingredient(1, size, consumables[0]);

            size.UpdateIngredients(ingredients, consumables);
            Assert.AreEqual(domainIngredient, size.Ingredients[0]);
            Assert.AreEqual(ingredients.Count, size.Ingredients.Count);
        }