Skip to content

Commit

Permalink
fix: keep event provenance timestamp for new commands
Browse files Browse the repository at this point in the history
  • Loading branch information
rikdepeuter authored and ArneD committed Jun 3, 2024
1 parent cf6f76b commit b8e81b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace ParcelRegistry.Consumer.Address.Projections
using Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector;
using Microsoft.EntityFrameworkCore;
using NodaTime;
using NodaTime.Text;
using Parcel;
using Parcel.Commands;
using Contracts = Be.Vlaanderen.Basisregisters.GrAr.Contracts.Common;
Expand Down Expand Up @@ -333,7 +334,7 @@ private async Task DetachBecauseRejected(

private static Provenance FromProvenance(Contracts.Provenance provenance) =>
new Provenance(
SystemClock.Instance.GetCurrentInstant(),
InstantPattern.General.Parse(provenance.Timestamp).Value,
Enum.Parse<Application>(Application.AddressRegistry.ToString()),
new Reason(provenance.Reason),
new Operator(string.Empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ await Then(async _ =>
&& z.DestinationAddressPersistentLocalId == destinationAddressPersistentLocalIdOne)
&& y.Readdresses.Any(z =>
z.SourceAddressPersistentLocalId == sourceAddressPersistentLocalIdTwo
&& z.DestinationAddressPersistentLocalId == destinationAddressPersistentLocalIdTwo)),
&& z.DestinationAddressPersistentLocalId == destinationAddressPersistentLocalIdTwo)
&& y.Provenance.Timestamp.ToString() == @event.Provenance.Timestamp
),
CancellationToken.None),
Times.Once);
_mockCommandHandler.Verify(x =>
Expand All @@ -103,7 +105,9 @@ await Then(async _ =>
&& y.Readdresses.Count == 1
&& y.Readdresses.Any(z =>
z.SourceAddressPersistentLocalId == sourceAddressPersistentLocalIdThree
&& z.DestinationAddressPersistentLocalId == destinationAddressPersistentLocalIdThree)),
&& z.DestinationAddressPersistentLocalId == destinationAddressPersistentLocalIdThree)
&& y.Provenance.Timestamp.ToString() == @event.Provenance.Timestamp
),
CancellationToken.None),
Times.Once);

Expand Down

0 comments on commit b8e81b3

Please sign in to comment.