Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

test(sim): cover qualification command localization arguments (#1999)

Eyal Golanc79395413560
diff --git a/changelog.d/release-qualification-cause-tests.md b/changelog.d/release-qualification-cause-tests.md
new file mode 100644
index 000000000..97f6a3bcf
--- /dev/null
+++ b/changelog.d/release-qualification-cause-tests.md
@@ -0,0 +1 @@
+- Add production-command regression coverage for qualification localization keys and arguments; game behavior is unchanged.
diff --git a/sim/Statecraft.Sim.Tests/QualificationTests.cs b/sim/Statecraft.Sim.Tests/QualificationTests.cs
index 325ce7b37..74dfc2487 100644
--- a/sim/Statecraft.Sim.Tests/QualificationTests.cs
+++ b/sim/Statecraft.Sim.Tests/QualificationTests.cs
@@ -377,4 +377,25 @@ public class QualificationTests
: queue.Append(new AssignWorkers("town_a", "job", jobs)).ToArray();
Assert.Empty(Step(c, s, Orders(max)).Rejected);
}
+
+ // Production rows must carry the literal localization contract, not only an English fallback message.
+ [Fact]
+ public void QualificationOrdersEmitTheirLocalizationKeysAndArguments()
+ {
+ var c = Town();
+ var s = WithCity(c, new City("town_a", 12, 8, 6, 0, 0, craftsmen: 3, jobsDefault: false,
+ qualified: new Qualified(3, 2, new[] { 1 })), new Unit(7, "halutz", 1, 0, 2));
+ s.Attention = 100;
+ var returned = Step(c, s, new ReturnCraftsmen("town_a", 2), new UnitOrder(7, Qualification.ReturnOrder));
+ Assert.Empty(returned.Rejected);
+ Assert.Equal(new[] { "2" }, Assert.Single(returned.Why, x => x.Key == "craftsmen_returned").Args);
+ Assert.Equal(new[] { "town_a" }, Assert.Single(returned.Why, x => x.Key == "pioneer_returned").Args);
+ var reassigned = Step(c, s, new ReassignCraftsmen("town_a", 1), new ReassignPioneers("town_a", "veteran_halutz", 1));
+ Assert.Empty(reassigned.Rejected);
+ Assert.Equal(new[] { "1" }, Assert.Single(reassigned.Why, x => x.Key == "craftsmen_reassigned").Args);
+ Assert.Equal(new[] { "1", "veteran" }, Assert.Single(reassigned.Why, x => x.Key == "pioneers_reassigned").Args);
+ var halutz = Step(c, s, new ReassignPioneers("town_a", "halutz", 1));
+ Assert.Empty(halutz.Rejected);
+ Assert.Equal(new[] { "1", "halutz" }, Assert.Single(halutz.Why, x => x.Key == "pioneers_reassigned").Args);
+ }
}