mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-10-16 23:49:19 +02:00
Make Scenery a domain aggregate with no I/O
Parsing and loading move to Infrastructure/Sceneries. Weather becomes a value object owning the "does this differ from the file" rule.
This commit is contained in:
22
StarterNG.Tests/Fakes/StubRandom.cs
Normal file
22
StarterNG.Tests/Fakes/StubRandom.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user