Files
przygody-pana-cegly/progression.tests/CoinsTests.cs
Gabriel Kaszewski 313a5315b1 feat(progression): Coins, LevelTime, SkillLevel core invariants (slice 1)
three bug-encoding invariants, one red/green cycle each:
- Coins.TrySubtract fails instead of clamping
- LevelTime rejects zero (continued-run zero best-times)
- SkillLevel has no zero (unowned is absence, not Level=1)

plan: drop signed NetCoins; add Attempt outcome as idempotency guard
2026-07-28 18:22:46 +02:00

18 lines
546 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);
}
}