using CardGame.Core; using Xunit; namespace Game.Core.Tests; public sealed class PhaseATests { [Fact] public void Clone_is_independent() { var state = new GameState(seed: 1) { Catalog = Cards.Catalog }; state.Players[0].Life = 12; var clone = RulesEngine.CloneState(state); clone.Players[0].Life = 7; Assert.Equal(12, state.Players[0].Life); Assert.Equal(7, clone.Players[0].Life); } [Fact] public void Rng_is_deterministic_for_same_seed() { var a = new GameRng(42); var b = new GameRng(42); Assert.Equal(a.NextUInt32(), b.NextUInt32()); Assert.Equal(a.NextInt(10), b.NextInt(10)); } [Fact] public void EndTurn_passes_priority_and_base_field_supplies() { var state = MatchSetup.Create( 7, Cards.Repeat(Cards.Wisp, 10), Cards.Repeat(Cards.Wisp, 10), Cards.Catalog, shuffle: false); Assert.Equal(1, state.Players[0].Energy); state = RulesEngine.Execute(state, new EndTurnAction(0)); Assert.Equal(1, state.ActivePlayerIndex); Assert.Equal(1, state.Players[1].Energy); } [Fact] public void GetLegalActions_offers_end_turn() { var state = MatchSetup.Create( 1, Cards.Repeat(Cards.Wisp, 10), Cards.Repeat(Cards.Wisp, 10), Cards.Catalog, shuffle: false); Assert.Contains(RulesEngine.GetLegalActions(state), a => a is EndTurnAction); } }