public ICoffee ProcessOrder(IProcessingOrder order) { if (order == null) { throw new ArgumentNullException(); } ICoffee coffee; var coffeeType = order.SelectedCoffeeType; CoffeSizeType coffeeSize; if (!Enum.TryParse(order.SelectedCoffeeSize, out coffeeSize)) { throw new ArgumentException(); } coffee = this.CreateCoffee(coffeeType, coffeeSize); foreach (var condimentAsString in order.SelectedCoffeeCodimentsList) { if (!this.condimentsStrategies.ContainsKey(condimentAsString)) { throw new ArgumentException(condimentAsString); } coffee = this.condimentsStrategies[condimentAsString](coffee); } return(coffee); }
public IProcessingOrder TransferDataTo(IProcessingOrder order) { order.SelectedCoffeeType = this.SelectedCoffeeType; order.SelectedCoffeeSize = this.SelectedCoffeeSize; order.SelectedCoffeeCodimentsList = this.CoffeeCondiments .Where(c => c.Value == true) .Select(c => c.Key) .ToList(); return(order); }
public ICoffee ExposedProcessOrder(IProcessingOrder order) { return(base.ProcessOrder(order)); }