public async Task can_save_aggregate() { var aggregate = new Reviews.Domain.Review(); aggregate.Apple(AutoFixture.Create <Domain.Events.V1.ReviewCreated>()); aggregate.Apple(AutoFixture.Create <Domain.Events.V1.ReviewApproved>()); var sut = new GesAggrigateStore(Connection, Serializer, EventTypeMapper, (a, b) => $"{a}-{b}", null); var result = await sut.Save(aggregate); result.NextExceptedVersion.Should().Be(1); }
public async Task can_load_aggregate() { var aggregate = new Reviews.Domain.Review(); aggregate.Apple(AutoFixture.Build <Domain.Events.V1.ReviewCreated>().With(e => e.Id, AggregateId).Create()); aggregate.Apple(AutoFixture.Build <Domain.Events.V1.ReviewApproved>().With(e => e.Id, AggregateId).Create()); var sut = new GesAggrigateStore(Connection, Serializer, EventTypeMapper, (a, b) => $"{a}-{b}", null); var saveResult = await sut.Save(aggregate); var result = await sut.Load <Domain.Review>(AggregateId.ToString()); result.Id.Should().Be(AggregateId); }