5777e641f6
- Extract per-monitor *TestData helper classes and rework tests to use them - Add boiler run-time tracker abstraction (implementation pending) - Drop unused NordPool init/update-result types and stale PLAN.md - Add qodana.yaml with the inspection set to keep the analysis focused
49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
using NordPool.Models;
|
|
|
|
namespace NordPool.Manager.Tests;
|
|
|
|
/// <summary>
|
|
/// Shared, deterministic datasets used by the NordPool tests.
|
|
/// Keeping the generators here avoids copy-pasted price loops across test classes.
|
|
/// </summary>
|
|
internal static class NordPoolTestData
|
|
{
|
|
public static readonly DateTime DayStart = new(2026, 3, 31, 0, 0, 0, DateTimeKind.Utc);
|
|
|
|
public static readonly DateTime TomorrowStart = DayStart.AddDays(1);
|
|
|
|
/// <summary>
|
|
/// Builds a contiguous set of 15-minute intervals starting at <paramref name="dayStart"/>.
|
|
/// </summary>
|
|
public static List<NordPoolDayPrice> CreateIntervals(
|
|
int count,
|
|
Func<int, double?> priceFactory,
|
|
DateTime? dayStart = null)
|
|
{
|
|
var start = dayStart ?? DayStart;
|
|
|
|
return Enumerable.Range(0, count)
|
|
.Select(i => new NordPoolDayPrice
|
|
{
|
|
Start = start.AddMinutes(i * NordPoolConsts.MinutesPerInterval),
|
|
End = start.AddMinutes((i + 1) * NordPoolConsts.MinutesPerInterval),
|
|
Price = priceFactory(i)
|
|
})
|
|
.ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// A full 96-interval day with a deterministic sawtooth price curve covering
|
|
/// negative, zero, cheap and expensive prices.
|
|
/// </summary>
|
|
public static List<NordPoolDayPrice> CreateGeneratedDay(DateTime? dayStart = null)
|
|
{
|
|
var start = dayStart ?? DayStart;
|
|
|
|
return CreateIntervals(
|
|
NordPoolConsts.MaxDailyIntervals,
|
|
i => Math.Round(15.0 * Math.Sin(i / 6.0) + (i % 8) - 2.0, 2),
|
|
start);
|
|
}
|
|
}
|