Пример #1
0
        public void Should_raise_prepared_event_when_barista_completes_preparation()
        {
            var id = Guid.NewGuid();
            var handler = new BaristaOrderCommandHandlers(repository);
            var e = new OrderPlaced(id, Guid.NewGuid(), 1);
            var eventHandler = new CashierOrderEventHandler(repository);
            eventHandler.Apply(e);

            var order = repository.GetById<BaristaOrder>(id);
            Assert.False(order.IsCompleted);

            var command = new CompleteOrder(id, order.Version);
            handler.Handle(command);

            order = repository.GetById<BaristaOrder>(id);
            Assert.True(order.IsCompleted);
        }
Пример #2
0
 public OrderController(BaristaOrderCommandHandlers handler)
 {
     this.handler = handler;
 }