From 5262b6b93c7b956251c481f15b6791bb9662591d Mon Sep 17 00:00:00 2001 From: MpakobecEx Date: Wed, 21 Oct 2026 13:10:03 +0500 Subject: [PATCH] Add a test proving guard also protects a rear-guard from retirement --- .../Vanguard.Rules.Tests/GameEngineTests.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/server/tests/Vanguard.Rules.Tests/GameEngineTests.cs b/server/tests/Vanguard.Rules.Tests/GameEngineTests.cs index 4f39d36..4ae6494 100644 --- a/server/tests/Vanguard.Rules.Tests/GameEngineTests.cs +++ b/server/tests/Vanguard.Rules.Tests/GameEngineTests.cs @@ -608,6 +608,22 @@ public class GameEngineTests Assert.Equal(14000, engine.EffectivePower(alfred)); } + [Fact] + public void Guard_Protects_RearGuard_From_Retirement() + { + var engine = ReadyToAttackRearGuard(); + Give(engine, 1, Barcgal); + + Assert.True(engine.Execute(new AttackCommand(3, 0)).Accepted); + Assert.True(engine.Execute(new GuardCommand(Barcgal)).Accepted); + Assert.True(engine.Execute(new PassGuardCommand()).Accepted); + + var defender = engine.State.Players[1]; + Assert.NotNull(defender.RearGuards[0]); + Assert.Contains(defender.Drop, c => c.PrintingId == Barcgal); + Assert.DoesNotContain(engine.Events, e => e is UnitRetiredEvent); + } + [Fact] public void ResolveTrigger_Rejects_When_Nothing_Is_Pending() {