f919d6b25b
- Wrap using directives in `#region` blocks across the Battery, Boiler and NordPool sources and tests - Expand single-statement guards and loops into braced blocks - Realign wrapped method arguments, chained calls and continuations - Replace target-typed `new()` with explicit generic construction and empty string literals with `string.Empty` - Flatten the boiler config expression and reindent the remaining touched files
52 lines
1.7 KiB
C#
52 lines
1.7 KiB
C#
#region
|
|
|
|
using NordPool.Models;
|
|
|
|
#endregion
|
|
|
|
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 DateTime(2026, 3, 31, 0, 0, 0, DateTimeKind.Utc);
|
|
|
|
/// <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)
|
|
})
|
|
];
|
|
}
|
|
|
|
/// <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);
|
|
}
|
|
} |