feat(CS-P3): throne capture + settlement winner in state machine + tests
Some checks failed
.NET Core / build (push) Has been cancelled

This commit is contained in:
Acentech Dev
2026-07-15 00:48:09 +03:00
parent 396527a62a
commit 9f2078d724
2 changed files with 47 additions and 1 deletions

View File

@@ -67,6 +67,30 @@ public class CastleSiegeContextTest
Assert.That(ctx.RegisteredGuilds, Does.Contain("Attackers"));
}
/// <summary>Tests that the throne-holding guild at siege end becomes the owner on settlement (P3).</summary>
[Test]
public async Task ThroneCaptureDuringSiegeBecomesOwnerOnSettlementAsync()
{
var ctx = new CastleSiegeContext(Config());
await ctx.ForceStartRegistrationAsync(T0);
await ctx.ForcePhaseAsync(CastleSiegePhase.Siege, T0);
ctx.CaptureThrone("Attackers");
Assert.That(ctx.OccupierGuildName, Is.EqualTo("Attackers"));
await ctx.TickAsync(T0.AddMinutes(20)); // Siege -> Settlement
await ctx.TickAsync(T0.AddMinutes(20)); // Settlement -> Ownership (owner assigned)
Assert.That(ctx.Phase, Is.EqualTo(CastleSiegePhase.Ownership));
Assert.That(ctx.OwnerGuildName, Is.EqualTo("Attackers"));
}
/// <summary>Tests that capturing the throne outside the siege phase is a no-op.</summary>
[Test]
public void CaptureThroneOutsideSiegeIsNoOp()
{
var ctx = new CastleSiegeContext(Config());
ctx.CaptureThrone("Attackers");
Assert.That(ctx.OccupierGuildName, Is.Null);
}
private static CastleSiegeConfiguration Config() => new()
{
RegistrationDuration = TimeSpan.FromMinutes(5),