From 8842c6629c9356b3907b68076dfdd3574a6e89a9 Mon Sep 17 00:00:00 2001 From: "Kristian F. Thomsen" Date: Mon, 20 Mar 2023 11:10:53 +0100 Subject: [PATCH] Remove dependency --- ...PointCharacteristicsDocumentWriterTests.cs | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/source/Tests/Infrastructure/OutgoingMessages/AccountingPointCharacteristics/AccountingPointCharacteristicsDocumentWriterTests.cs b/source/Tests/Infrastructure/OutgoingMessages/AccountingPointCharacteristics/AccountingPointCharacteristicsDocumentWriterTests.cs index ba4a3bc707..7faacda708 100644 --- a/source/Tests/Infrastructure/OutgoingMessages/AccountingPointCharacteristics/AccountingPointCharacteristicsDocumentWriterTests.cs +++ b/source/Tests/Infrastructure/OutgoingMessages/AccountingPointCharacteristics/AccountingPointCharacteristicsDocumentWriterTests.cs @@ -29,6 +29,7 @@ using Infrastructure.Configuration.Serialization; using Infrastructure.OutgoingMessages.AccountingPointCharacteristics; using Infrastructure.OutgoingMessages.Common; +using NodaTime; using Tests.Infrastructure.OutgoingMessages.Asserts; using Xunit; using MarketActivityRecord = Domain.OutgoingMessages.AccountingPointCharacteristics.MarketActivityRecord; @@ -38,14 +39,12 @@ namespace Tests.Infrastructure.OutgoingMessages.AccountingPointCharacteristics; public class AccountingPointCharacteristicsDocumentWriterTests { private readonly AccountingPointCharacteristicsMessageWriter _messageWriter; - private readonly ISystemDateTimeProvider _systemDateTimeProvider; private readonly IMessageRecordParser _messageRecordParser; private readonly SampleData _sampleData; private ISchemaProvider? _schemaProvider; public AccountingPointCharacteristicsDocumentWriterTests() { - _systemDateTimeProvider = new SystemDateTimeProvider(); _messageRecordParser = new MessageRecordParser(new Serializer()); _messageWriter = new AccountingPointCharacteristicsMessageWriter(_messageRecordParser); _sampleData = new SampleData(); @@ -64,6 +63,18 @@ public async Task Document_is_valid() await AssertMessage(message, header, marketActivityRecords).ConfigureAwait(false); } + private static MessageHeader CreateHeader(ProcessType? processType = null, MarketRole? senderRole = null, MarketRole? receiverRole = null) + { + return new MessageHeader( + processType is null ? ProcessType.MoveIn.Name : processType.Name, + "SenderId", + senderRole is null ? MarketRole.MeteringPointAdministrator.Name : senderRole.Name, + "ReceiverId", + receiverRole is null ? MarketRole.EnergySupplier.Name : receiverRole.Name, + Guid.NewGuid().ToString(), + SystemClock.Instance.GetCurrentInstant()); + } + private static void AssertMarketActivityRecords(List marketActivityRecords, XDocument document) { AssertXmlMessage.AssertMarketActivityRecordCount(document, 1); @@ -95,16 +106,4 @@ private async Task AssertConformsToSchema(Stream message) .ConfigureAwait(false); await AssertXmlMessage.AssertConformsToSchemaAsync(message, schema!).ConfigureAwait(false); } - - private MessageHeader CreateHeader(ProcessType? processType = null, MarketRole? senderRole = null, MarketRole? receiverRole = null) - { - return new MessageHeader( - processType is null ? ProcessType.MoveIn.Name : processType.Name, - "SenderId", - senderRole is null ? MarketRole.MeteringPointAdministrator.Name : senderRole.Name, - "ReceiverId", - receiverRole is null ? MarketRole.EnergySupplier.Name : receiverRole.Name, - Guid.NewGuid().ToString(), - _systemDateTimeProvider.Now()); - } }