Skip to content

Commit

Permalink
fix: use consumed event provenance timestamp for command
Browse files Browse the repository at this point in the history
  • Loading branch information
jvandaal authored and ArneD committed Jun 3, 2024
1 parent f64447f commit 963b09c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace StreetNameRegistry.Consumer.Projections
using Be.Vlaanderen.Basisregisters.GrAr.Contracts.MunicipalityRegistry;
using Be.Vlaanderen.Basisregisters.GrAr.Provenance;
using Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector;
using NodaTime;
using NodaTime.Text;
using StreetNameRegistry.Municipality;
using StreetNameRegistry.Municipality.Commands;
Expand Down Expand Up @@ -237,7 +236,7 @@ public static IHasCommandProvenance GetCommand(IQueueMessage message)

private static Provenance FromProvenance(Contracts.Provenance provenance, Modification modification = Modification.Update) =>
new Provenance(
SystemClock.Instance.GetCurrentInstant(),
InstantPattern.General.Parse(provenance.Timestamp).Value,
Enum.Parse<Application>(provenance.Application),
new Reason(provenance.Reason),
new Operator(string.Empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ public async Task GivenMunicipalityWasRegistered_ThenImportMunicipality()
await Then(async _ =>
{
_mockCommandHandler.Verify(
x => x.Handle(It.Is<IHasCommandProvenance>(x => x is ImportMunicipality), CancellationToken.None),
x => x.Handle(
It.Is<IHasCommandProvenance>(y =>
y is ImportMunicipality
&& y.Provenance.Timestamp.ToString() == @event.Provenance.Timestamp),
CancellationToken.None),
Times.Once);
await Task.CompletedTask;
});
Expand Down

0 comments on commit 963b09c

Please sign in to comment.