feat: add ToCompact extension for NordPoolDayPrice collections

Made-with: Cursor
This commit is contained in:
Marius
2026-03-19 16:15:39 +02:00
parent b4e465573f
commit 3e5afa42c6
2 changed files with 49 additions and 0 deletions
@@ -150,4 +150,41 @@ public class CompactNordPoolDayPriceTests
act.Should().Throw<JsonException>();
}
[Fact]
public void ToCompact_ShouldConvertAllPrices()
{
var prices = new List<NordPoolDayPrice>
{
new() { Start = TestStart, End = TestEnd, Price = 10.0 },
new() { Start = TestEnd, End = TestEnd.AddMinutes(15), Price = 11.0 }
};
var result = prices.ToCompact();
result.Should().HaveCount(2);
result[0].Start.Should().Be(TestStartEpoch);
result[0].Price.Should().Be(10.0);
result[1].Price.Should().Be(11.0);
}
[Fact]
public void ToCompact_WhenEmpty_ShouldReturnEmptyList()
{
var prices = Array.Empty<NordPoolDayPrice>();
var result = prices.ToCompact();
result.Should().BeEmpty();
}
[Fact]
public void ToCompact_WhenNull_ShouldReturnEmptyList()
{
IEnumerable<NordPoolDayPrice>? prices = null;
var result = prices.ToCompact();
result.Should().BeEmpty();
}
}