feat(CS-P3): throne capture + settlement winner in state machine + tests
Some checks failed
.NET Core / build (push) Has been cancelled
Some checks failed
.NET Core / build (push) Has been cancelled
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user