Beispiel #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);
			}
Beispiel #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);
            }
Beispiel #3
0
		/// <summary>
		///   Notifies the recipe that production of the given
		///   <paramref name="container" /> failed.
		/// </summary>
		public void DropContainer(PillContainer container)
		{
			_producedAmount--;
			RemoveContainer(container);
		}
Beispiel #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);
		}
Beispiel #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);
		}
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #8
0
 /// <summary>
 ///   Notifies the recipe that production of the given
 ///   <paramref name="container" /> failed.
 /// </summary>
 public void DropContainer(PillContainer container)
 {
     _producedAmount--;
     RemoveContainer(container);
 }