示例#1
0
        public void ProcessEvent()
        {
            var movement = "movementId";
            var location = "location";
            var item     = new StockItem("item", "1");

            var fromLocation        = "fromLocationId";
            var eventHandlerId      = $"{typeof(Movement).Name}\\{movement}";
            var storedEventStreamId = eventHandlerId;

            var @event = EventFactory.Default.CreateEvent <Location, MovedIn>(location, 3, "commandId", "correlationId", new MovedIn(movement, location, item, fromLocation));

            var eventEngine = DomainFactory.CreateEventHandler(this.boundedContextModel, this.eventStore.Object);

            var commands = eventEngine.Handle(@event, eventHandlerId, typeof(Movement));

            Assert.IsTrue(commands.Count() == 0);

            this.eventStore.Verify(x => x.Store(storedEventStreamId, It.Is <IEnumerable <IEvent> >(x => x.First().EventBody as MovedIn == @event.EventBody)));
        }