public static ItemRackPosition InitInfinityItems(ItemRackState inState) { return(new ItemRackPosition( Tuple.Create( 0, new ItemRack { Item = new Item { Name = "Item0", Price = 120, Shape = ItemShapeType.Can350 }, State = inState, } ), Tuple.Create( 2, new ItemRack { Item = new Item { Name = "Item2", Price = 250, Shape = ItemShapeType.Can500 }, State = inState, } ) )); }
private string RackStatusToString(ItemRackState inState) { switch (inState) { case ItemRackState.CanPurchase: return "*"; case ItemRackState.Soldout: return "-"; case ItemRackState.RackNotExist: return "x"; case ItemRackState.MissingChange: return "!"; default: return " "; } }
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; } }