Example #1
0
        private void StockMessageRecieved(string message)
        {
            StockEvent   stockEvent   = StockEvent.From(message);
            StockCommand stockCommand = _buyer.Process(stockEvent);

            if (stockCommand != StockCommand.None())
            {
                _connection.SendMessage(stockCommand.ToString());
            }

            _repository.Save(ItemId, _buyer);

            Notify(nameof(CurrentPrice));
            Notify(nameof(NumberInStock));
            Notify(nameof(BoughtSoFar));
            Notify(nameof(State));
        }
Example #2
0
 public void Buy(int price, int numberToBuy)
 {
     _connection.SendMessage(string.Format(BuyCommandFormat, price, numberToBuy));
 }