Beispiel #1
0
        private async Task Project(StorageEvent @event, OrderDispatched e)
        {
            string[] queries =
            {
                $"g.addV('{@event.EventBody.GetType().Name}').property('id', '{@event.EventId}')",
                $"g.V('{@event.StreamId}').addE('contains').to(g.V('{@event.EventId}'))"
            };

            await ExecuteGremlinQueries(queries);
        }
Beispiel #2
0
        public void Raise_should_publish_OrderDispatchedEvent()
        {
            var shopOrder = new ShopOrder
            {
                Id         = 123,
                OrderLines =
                {
                    new ShopOrderLine
                    {
                        ProductUrlName = "ABC",
                        Quantity       = 2,
                        SizeName       = "Small"
                    },
                    new ShopOrderLine
                    {
                        ProductUrlName = "DEF",
                        Quantity       = 1,
                        SizeName       = "Large"
                    },
                    new ShopOrderLine
                    {
                        ProductUrlName = "HIJ",
                        Quantity       = 10,
                        SizeName       = "Huge"
                    },
                }
            };

            var shopDispatchedEvent = new OrderDispatched(shopOrder);

            dispactchMessageOnOrderDispatch.Handle(shopDispatchedEvent);

            var externalDispatchedEvent = domainEventService.Event as OrderDispatchedEvent;

            externalDispatchedEvent.ShouldNotBeNull();
            externalDispatchedEvent.Order.OrderId.ShouldEqual(shopOrder.Id);

            externalDispatchedEvent.Order.Lines[0].ProductName.ShouldEqual(shopOrder.OrderLines[0].ProductUrlName);
            externalDispatchedEvent.Order.Lines[0].Quantity.ShouldEqual(shopOrder.OrderLines[0].Quantity);
            externalDispatchedEvent.Order.Lines[0].SizeName.ShouldEqual(shopOrder.OrderLines[0].SizeName);

            externalDispatchedEvent.Order.Lines[1].ProductName.ShouldEqual(shopOrder.OrderLines[1].ProductUrlName);
            externalDispatchedEvent.Order.Lines[1].Quantity.ShouldEqual(shopOrder.OrderLines[1].Quantity);
            externalDispatchedEvent.Order.Lines[1].SizeName.ShouldEqual(shopOrder.OrderLines[1].SizeName);

            externalDispatchedEvent.Order.Lines[2].ProductName.ShouldEqual(shopOrder.OrderLines[2].ProductUrlName);
            externalDispatchedEvent.Order.Lines[2].Quantity.ShouldEqual(shopOrder.OrderLines[2].Quantity);
            externalDispatchedEvent.Order.Lines[2].SizeName.ShouldEqual(shopOrder.OrderLines[2].SizeName);
        }
Beispiel #3
0
        public void Dispatch_should_raise_OrderDispatched_event()
        {
            OrderDispatched orderDispatched = null;

            using (DomainEvent.TestWith(e => orderDispatched = e as OrderDispatched))
            {
                var order = new Order {
                    OrderStatus = OrderStatus.Created
                };

                order.Dispatch(new User());

                orderDispatched.ShouldNotBeNull();
                orderDispatched.Order.ShouldBeTheSameAs(order);
            }
        }
Beispiel #4
0
 public void Handle(OrderDispatched domainEvent)
 {
     Log.Info("Handling {0} by {1}", domainEvent.GetType(), GetType());
 }
Beispiel #5
0
 public void When(OrderDispatched @event)
 {
 }