Inheritance: MicroServices.Common.Event
Exemplo n.º 1
0
 private void Apply(OrderPlaced e)
 {
     Id = e.Id;
     ProductId = e.ProductId;
     Quantity = e.Quantity;
     HasBeenPaid = false;
 }
Exemplo n.º 2
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);
        }