Exemplo n.º 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));
        }
Exemplo n.º 2
0
        public void Buy_command_is_of_appropriate_content()
        {
            StockCommand command = StockCommand.Buy(123, 10);

            command.ToString().ShouldEqual("Command: BUY; Price: 123; Number: 10");
        }