diff --git a/src/Fluss.Testing/AggregateTestBed.cs b/src/Fluss.Testing/AggregateTestBed.cs index e300b2d..876fd04 100644 --- a/src/Fluss.Testing/AggregateTestBed.cs +++ b/src/Fluss.Testing/AggregateTestBed.cs @@ -18,7 +18,7 @@ public AggregateTestBed() { var validator = new Mock(); validator.Setup(v => v.ValidateEvent(It.IsAny(), It.IsAny?>())) - .Returns(_ => Task.CompletedTask); + .Returns?>((_, _) => Task.CompletedTask); validator.Setup(v => v.ValidateAggregate(It.IsAny(), It.IsAny())) .Returns((_, _) => Task.CompletedTask); diff --git a/src/Fluss.UnitTest/Core/UnitOfWork/UnitOfWorkTest.cs b/src/Fluss.UnitTest/Core/UnitOfWork/UnitOfWorkTest.cs index c33a903..d6e157d 100644 --- a/src/Fluss.UnitTest/Core/UnitOfWork/UnitOfWorkTest.cs +++ b/src/Fluss.UnitTest/Core/UnitOfWork/UnitOfWorkTest.cs @@ -29,7 +29,7 @@ public UnitOfWorkTest() _validator = new Mock(MockBehavior.Strict); _validator.Setup(v => v.ValidateEvent(It.IsAny(), It.IsAny?>())) - .Returns(_ => Task.CompletedTask); + .Returns?>((_, _) => Task.CompletedTask); _validator.Setup(v => v.ValidateAggregate(It.IsAny(), It.IsAny())) .Returns((_, _) => Task.CompletedTask); diff --git a/src/Fluss/UnitOfWork/UnitOfWork.Aggregates.cs b/src/Fluss/UnitOfWork/UnitOfWork.Aggregates.cs index a5450cb..29661fa 100644 --- a/src/Fluss/UnitOfWork/UnitOfWork.Aggregates.cs +++ b/src/Fluss/UnitOfWork/UnitOfWork.Aggregates.cs @@ -94,7 +94,8 @@ internal async ValueTask CommitInternal() using var activity = FlussActivitySource.Source.StartActivity(); var validatedEnvelopes = new List(); - foreach (var envelope in PublishedEventEnvelopes) { + foreach (var envelope in PublishedEventEnvelopes) + { await _validator.ValidateEvent(envelope, validatedEnvelopes); validatedEnvelopes.Add(envelope); } diff --git a/src/Fluss/Validation/RootValidator.cs b/src/Fluss/Validation/RootValidator.cs index d7f314b..f04a9b2 100644 --- a/src/Fluss/Validation/RootValidator.cs +++ b/src/Fluss/Validation/RootValidator.cs @@ -61,7 +61,8 @@ public async Task ValidateEvent(EventEnvelope envelope, IReadOnlyList(); var versionedUnitOfWork = unitOfWork.WithPrefilledVersion(envelope.Version - willBePublishedEnvelopes.Count - 1); - foreach (var willBePublishedEnvelope in willBePublishedEnvelopes) { + foreach (var willBePublishedEnvelope in willBePublishedEnvelopes) + { versionedUnitOfWork.PublishedEventEnvelopes.Enqueue(willBePublishedEnvelope); }