fix: derive test constants from NordPoolConsts to prevent stale values
Made-with: Cursor
This commit is contained in:
@@ -7,7 +7,7 @@ namespace NordPool.Manager.Tests;
|
||||
|
||||
public class CompactNordPoolDayPriceTests
|
||||
{
|
||||
private const int FifteenMinutesInSeconds = 900;
|
||||
private const int IntervalDurationSeconds = MinutesPerInterval * 60;
|
||||
|
||||
private static readonly DateTime TestStart = new(2026, 3, 19, 10, 0, 0, DateTimeKind.Utc);
|
||||
private static readonly DateTime TestEnd = TestStart.AddMinutes(MinutesPerInterval);
|
||||
@@ -112,12 +112,12 @@ public class CompactNordPoolDayPriceTests
|
||||
var prices = new List<CompactNordPoolDayPrice>
|
||||
{
|
||||
new() { Start = TestStartEpoch, End = TestEndEpoch, Price = 10.0 },
|
||||
new() { Start = TestEndEpoch, End = TestEndEpoch + FifteenMinutesInSeconds, Price = 11.0 }
|
||||
new() { Start = TestEndEpoch, End = TestEndEpoch + IntervalDurationSeconds, Price = 11.0 }
|
||||
};
|
||||
|
||||
var json = JsonSerializer.Serialize(prices);
|
||||
|
||||
json.Should().Be($"[[{TestStartEpoch},{TestEndEpoch},10],[{TestEndEpoch},{TestEndEpoch + FifteenMinutesInSeconds},11]]");
|
||||
json.Should().Be($"[[{TestStartEpoch},{TestEndEpoch},10],[{TestEndEpoch},{TestEndEpoch + IntervalDurationSeconds},11]]");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -192,12 +192,11 @@ public class CompactNordPoolDayPriceTests
|
||||
[Fact]
|
||||
public void SerializedSize_WithMaxEntries_ShouldBeUnderHaAttributeLimit()
|
||||
{
|
||||
const int maxEntries = 192;
|
||||
const int haAttributeByteLimitBytes = 16_384;
|
||||
var dayStart = new DateTime(2026, 3, 19, 0, 0, 0, DateTimeKind.Utc);
|
||||
var prices = new List<NordPoolDayPrice>();
|
||||
|
||||
for (var i = 0; i < maxEntries; i++)
|
||||
for (var i = 0; i < MaxExpectedPriceEntries; i++)
|
||||
{
|
||||
var start = dayStart.AddMinutes(i * MinutesPerInterval);
|
||||
prices.Add(new NordPoolDayPrice
|
||||
|
||||
Reference in New Issue
Block a user