Skip to content

Commit

Permalink
two trans in same in-rsm-12
Browse files Browse the repository at this point in the history
  • Loading branch information
MWO1024 committed Dec 3, 2024
1 parent 031b646 commit 582ea6f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,20 @@ public async Task When_ActorPeeksAllMessages_Then_ReceivesOneDocumentWithCorrect
GivenNowIs(Instant.FromUtc(2024, 7, 1, 14, 57, 09));
GivenAuthenticatedActorIs(currentActor.ActorNumber, currentActor.ActorRole);

var transactionIdPrefix = Guid.NewGuid().ToString("N");

await GivenReceivedMeteredDataForMeasurementPoint(
documentFormat: DocumentFormat.Xml,
senderActorNumber: currentActor.ActorNumber,
[
("12356478912356478912356478912356478",
($"{transactionIdPrefix}-1",
InstantPattern.General.Parse("2024-11-28T13:51:42Z").Value,
InstantPattern.General.Parse("2024-11-29T09:15:28Z").Value,
Resolution.Hourly),
($"{transactionIdPrefix}-2",
InstantPattern.General.Parse("2024-11-24T18:51:58Z").Value,
InstantPattern.General.Parse("2024-11-25T03:39:45Z").Value,
Resolution.QuarterHourly),
]);

await WhenMeteredDataForMeasurementPointProcessIsInitialized(senderSpy.LatestMessage!);
Expand All @@ -65,20 +71,17 @@ await GivenReceivedMeteredDataForMeasurementPoint(
DocumentFormat.Json);

// Assert
PeekResultDto peekResult;
using (new AssertionScope())
using var foo = new AssertionScope();
foreach (var peekResultDto in peekResults)
{
peekResult = peekResults
.Should()
.ContainSingle("there should be one message given the MDFMP incoming message")
.Subject;
}
peekResultDto.Bundle.Should().NotBeNull("peek result should contain a document stream");

peekResult.Bundle.Should().NotBeNull("peek result should contain a document stream");
using var reader = new StreamReader(peekResultDto.Bundle, Encoding.UTF8);
var document = await reader.ReadToEndAsync();

using (var reader = new StreamReader(peekResult.Bundle, Encoding.UTF8))
{
(await reader.ReadToEndAsync()).Should().Be("foo");
document.Should().Contain($"\"mRID\": \"{transactionIdPrefix}");
document.Should().Contain("\"Point\": [");
document.Should().Contain("\"quantity\": 1005");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private Task<MarketDocumentStream> WriteDocument(
return new MeteredDateForMeasurementPointCimJsonDocumentWriter(
_parser,
serviceProvider.GetRequiredService<JavaScriptEncoder>())
.WriteAsync(header, new[] { records }, CancellationToken.None);
.WriteAsync(header, [records], CancellationToken.None);
}

private IAssertMeteredDateForMeasurementPointDocumentDocument AssertDocument(
Expand Down

0 comments on commit 582ea6f

Please sign in to comment.