VendingMachine.Console.CommandRunnerRepository.NotifyPurchaseLogs C# (CSharp) Method

NotifyPurchaseLogs() private method

private NotifyPurchaseLogs ( int inPosition, ItemRackState inState, ConsoleLogEventHandler inEvent ) : void
inPosition int
inState ItemRackState
inEvent ConsoleLogEventHandler
return void
        private void NotifyPurchaseLogs(int inPosition, ItemRackState inState, ConsoleLogEventHandler inEvent)
        {
            switch (inState) {
            case ItemRackState.CanPurchase:
                var item = this.PurchaseContext.Purchase(inPosition);

                this.OnLogUpdated(inEvent, string.Format("Purchased !! [{0}]", item.Name));
                break;
            case ItemRackState.RackNotExist:
                this.OnLogUpdated(inEvent, "Item is not placed.");
                break;
            case ItemRackState.MissingChange:
                this.OnLogUpdated(inEvent, "Sorry, can not purchase this item because of lack of changes.");
                break;
            case ItemRackState.Soldout:
                this.OnLogUpdated(inEvent, "Sorry, this item has been sold out.");
                break;
            case ItemRackState.CanNotPurchase:
                var amount = this.PurchaseContext.ReceivedTotal;
                var price = this.PurchaseContext.Racks[inPosition].Item.Price;

                this.OnLogUpdated(inEvent, string.Format(
                    "Money enough to purchase is not inserted. (left: {0})", price-amount
                    ));
                break;
            }
        }