Skip to content

Commit

Permalink
test: pass correct instant to date filter
Browse files Browse the repository at this point in the history
  • Loading branch information
VMelnalksnis committed Oct 16, 2024
1 parent 3298266 commit edf7a24
Showing 1 changed file with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,24 @@ public async Task PutTransaction()
var detailedTransactions = await _client.GetDetailedTransactionsAsync(new(null, null));
detailedTransactions.Should().Contain(detailed => detailed.Id == transactionId);

var transferCreation = new TransferCreation
{
TransactionId = transactionId,
SourceAmount = 1,
SourceAccountId = _account1.Currencies.First().Id,
TargetAmount = 1,
TargetAccountId = _account2.Currencies.First().Id,
Order = 2,
ValuedAt = SystemClock.Instance.GetCurrentInstant(),
};

await _client.CreateTransferAsync(transactionId, _account1.Id, _account2.Id);
var currentTime = SystemClock.Instance.GetCurrentInstant();
var expectedDate = currentTime + Duration.FromDays(2);
await _client.PutTransferAsync(Guid.NewGuid(), transferCreation with { ValuedAt = expectedDate, Order = 3 });

(await _client.GetDetailedTransactionsAsync(new(Instant.MinValue, currentTime)))
var firstTransfer = await _client.CreateTransferAsync(transactionId, _account1.Id, _account2.Id);

var bookedAt = firstTransfer.BookedAt!.Value;
var expectedDate = bookedAt + Duration.FromDays(2);
await _client.PutTransferAsync(
Guid.NewGuid(),
new()
{
TransactionId = transactionId,
SourceAmount = 1,
SourceAccountId = _account1.Currencies.First().Id,
TargetAmount = 1,
TargetAccountId = _account2.Currencies.First().Id,
Order = 2,
ValuedAt = expectedDate,
});

(await _client.GetDetailedTransactionsAsync(new(Instant.MinValue, bookedAt)))
.Should()
.NotContain(detailedTransaction => detailedTransaction.Id == transactionId);

Expand Down

0 comments on commit edf7a24

Please sign in to comment.