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.
24 lines
702 B
C#
24 lines
702 B
C#
namespace Mr.BrickAdventures.Progression.Tests;
|
|
|
|
public class CoinsTests
|
|
{
|
|
[Fact]
|
|
public void Subtracting_more_than_held_fails_and_leaves_the_amount_untouched()
|
|
{
|
|
var held = Coins.Of(10);
|
|
|
|
var succeeded = held.TrySubtract(Coins.Of(30), out var remaining);
|
|
|
|
Assert.False(succeeded);
|
|
// Not clamped to zero. A caller that ignores the bool sees coins un-spent,
|
|
// which is the safe outcome; clamping would silently consume what wasn't there.
|
|
Assert.Equal(Coins.Of(10), remaining);
|
|
}
|
|
|
|
[Fact]
|
|
public void A_negative_quantity_of_coins_cannot_exist()
|
|
{
|
|
Assert.Throws<ArgumentOutOfRangeException>(() => Coins.Of(-1));
|
|
}
|
|
}
|