Esempio n. 1
0
			public virtual void Dispense(PillContainer container, Ingredient ingredient)
			{
				if (ingredient.Type != IngredientType)
					throw new InvalidOperationException("Incorrect ingredient requested");
				if (Amount < ingredient.Amount)
					throw new InvalidOperationException($"Insufficient amount available of ingredient {ingredient.Type}");

				Amount -= ingredient.Amount;
				container.AddIngredient(ingredient);
			}
Esempio n. 2
0
            public virtual void Dispense(PillContainer container, Ingredient ingredient)
            {
                if (ingredient.Type != IngredientType)
                {
                    throw new InvalidOperationException("Incorrect ingredient requested");
                }
                if (Amount < ingredient.Amount)
                {
                    throw new InvalidOperationException($"Insufficient amount available of ingredient {ingredient.Type}");
                }

                Amount -= ingredient.Amount;
                container.AddIngredient(ingredient);
            }
Esempio n. 3
0
		/// <summary>
		///   Notifies the recipe that production of the given
		///   <paramref name="container" /> failed.
		/// </summary>
		public void DropContainer(PillContainer container)
		{
			_producedAmount--;
			RemoveContainer(container);
		}
Esempio n. 4
0
		/// <summary>
		///   Notifies the recipe that the given <paramref name="container" /> was
		///   completely processed and has left the production system.
		/// </summary>
		public void RemoveContainer(PillContainer container)
		{
			_activeContainers.Remove(container);
		}
Esempio n. 5
0
		/// <summary>
		///   Adds a <paramref name="container" /> to the recipe's active containers.
		///   This is called when processing of the container starts.
		/// </summary>
		public void AddContainer(PillContainer container)
		{
			_producedAmount++;
			_activeContainers.Add(container);
		}
Esempio n. 6
0
 /// <summary>
 ///   Notifies the recipe that the given <paramref name="container" /> was
 ///   completely processed and has left the production system.
 /// </summary>
 public void RemoveContainer(PillContainer container)
 {
     _activeContainers.Remove(container);
 }
Esempio n. 7
0
 /// <summary>
 ///   Adds a <paramref name="container" /> to the recipe's active containers.
 ///   This is called when processing of the container starts.
 /// </summary>
 public void AddContainer(PillContainer container)
 {
     _producedAmount++;
     _activeContainers.Add(container);
 }
Esempio n. 8
0
 /// <summary>
 ///   Notifies the recipe that production of the given
 ///   <paramref name="container" /> failed.
 /// </summary>
 public void DropContainer(PillContainer container)
 {
     _producedAmount--;
     RemoveContainer(container);
 }