mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-10-17 16:09:20 +02:00
Parsing and loading move to Infrastructure/Sceneries. Weather becomes a value object owning the "does this differ from the file" rule.
23 lines
609 B
C#
23 lines
609 B
C#
using StarterNG.Application.Abstractions;
|
|
|
|
namespace StarterNG.Tests.Fakes;
|
|
|
|
/// <summary>
|
|
/// Randomness pinned to the low end of every range, so weather that varies in
|
|
/// production is deterministic in tests.
|
|
/// </summary>
|
|
public sealed class StubRandom : IRandomSource
|
|
{
|
|
private readonly int _fixedValue;
|
|
|
|
public StubRandom(int fixedValue = 0)
|
|
{
|
|
_fixedValue = fixedValue;
|
|
}
|
|
|
|
public int Next(int minInclusive, int maxExclusive) =>
|
|
Math.Clamp(minInclusive + _fixedValue, minInclusive, Math.Max(minInclusive, maxExclusive - 1));
|
|
|
|
public double NextDouble() => 0.0;
|
|
}
|