Ejemplo n.º 1
0
        public async Task OnFindAsync_WithVersion_BuildAggregateFromEventStore()
        {
            var fakeEvent      = new FakeEvent(Guid.Empty, 1, "Version 1");
            var mockEventStore = new Mock <IEventStore>();

            mockEventStore.Setup(t => t.LoadByMaxVersionAsync <FakeAggregate>(Guid.Empty, 1)).ReturnsAsync(Enumerable.Repeat(fakeEvent, 1));

            var sut = new Repository(
                mockEventStore.Object,
                Mock.Of <ISnapshotStore>(),
                Mock.Of <IEventBus>(),
                Mock.Of <ILogger>()
                );

            var aggregate = await sut.GetByIdAsync <FakeAggregate>(Guid.Empty, 1);

            mockEventStore.Verify(t => t.LoadByMaxVersionAsync <FakeAggregate>(Guid.Empty, 1));
        }
Ejemplo n.º 2
0
 protected void Apply(FakeEvent @event)
 {
     Value = @event.Value;
 }