Skip to content

Commit

Permalink
Remove dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristian F. Thomsen committed Mar 20, 2023
1 parent 312747d commit 8842c66
Showing 1 changed file with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand All @@ -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<MarketActivityRecord> marketActivityRecords, XDocument document)
{
AssertXmlMessage.AssertMarketActivityRecordCount(document, 1);
Expand Down Expand Up @@ -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());
}
}

0 comments on commit 8842c66

Please sign in to comment.