Files
przygody-pana-cegly/progression.tests/LevelTimeTests.cs
Gabriel Kaszewski 9767941c65 feat(progression): remaining slice 1 value objects
Lives (floors at zero, exhaustion observable), LevelId, SkillId,
PlaythroughId (never self-generates, keeps tests deterministic),
StatName enum, LevelTime rejects NaN/infinity.

14 tests. Arithmetic/comparison members deferred to the slices whose
behaviour needs them rather than added speculatively.
2026-07-28 18:27:26 +02:00

24 lines
937 B
C#

namespace Mr.BrickAdventures.Progression.Tests;
public class LevelTimeTests
{
[Fact]
public void Zero_is_not_a_completion_time()
{
// GetCurrentLevelTime() returns 0 whenever the speedrun timer was never started, which
// today is every continued run — so zero-second "best times" get written to the ghost
// files. Rejecting zero makes that unrepresentable rather than merely unlikely.
Assert.Throws<ArgumentOutOfRangeException>(() => LevelTime.Of(0));
}
[Theory]
[InlineData(double.NaN)]
[InlineData(double.PositiveInfinity)]
public void A_time_that_is_not_a_finite_number_is_rejected(double seconds)
{
// Times are derived from subtracting tick counts, so a stale or unset start time can
// produce NaN or infinity rather than a plausible-but-wrong number.
Assert.Throws<ArgumentOutOfRangeException>(() => LevelTime.Of(seconds));
}
}