A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
#nullable enable
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
using Statecraft.Game;
using Statecraft.Game.UI;
using Statecraft.Sim;
/// <summary>The content and review gates applied by every Unity player build made with -shareable.</summary>
public class BuildGateTests
{
static Type SettlementReview => Type.GetType("Statecraft.Game.EditorTools.SettlementControlStringReview, Assembly-CSharp-Editor")!;
static object ParseSettlementReview(string yaml, string file) =>
SettlementReview.GetMethod("Parse", BindingFlags.Public | BindingFlags.Static)!.Invoke(null, new object[] { yaml, file })!;
static string? SettlementReviewRefusal(object? review, UiText en, UiText he) =>
(string?)SettlementReview.GetMethod("Refusal", BindingFlags.Public | BindingFlags.Static)!.Invoke(null, new[] { review, en, he });
static bool IsSettlementControlKey(string key) =>
(bool)SettlementReview.GetMethod("IsSettlementControlKey", BindingFlags.Public | BindingFlags.Static)!
.Invoke(null, new object[] { key })!;
internal static string? ReviewedSettlementControlStrings()
{
var review = ParseSettlementReview(File.ReadAllText(UiPaths.SettlementControlStringsReview), UiPaths.SettlementControlStringsReview);
SettlementReview.GetProperty("Status")!.SetValue(review, ReleaseGate.ReviewedStatus);
var en = UiText.Parse(File.ReadAllText(UiPaths.Strings), "strings.en.yaml");
var he = UiText.Parse(File.ReadAllText(UiPaths.StringsHebrew), "strings.he.yaml");
return SettlementReviewRefusal(review, en, he);
}
static string? Refusal(Content c)
{
var t = Type.GetType("Statecraft.Game.EditorTools.Build, Assembly-CSharp-Editor");
Assert.IsNotNull(t, "Build exists");
return (string?)t!.GetMethod("ShareableRefusal", BindingFlags.Public | BindingFlags.Static)!.Invoke(null,
new object?[] { c, null, false, null, null, ReviewedSettlementControlStrings() }); // event content only
}
[Test]
public void AShareableBuildWaitsForTheSettlementControlStringsReview() // R-GATE-002
{
var en = UiText.Parse("map.control.depopulated: Depopulated\n", "strings.en.yaml");
var he = UiText.Parse("map.control.depopulated: מרוקן מתושביו\n", "strings.he.yaml");
var review = ParseSettlementReview(
"status: pending\nstrings:\n - { key: map.control.depopulated, en: Depopulated, he: מרוקן מתושביו }\n", "fixture");
StringAssert.Contains("sensitivity review", SettlementReviewRefusal(review, en, he));
SettlementReview.GetProperty("Status")!.SetValue(review, ReleaseGate.ReviewedStatus);
Assert.IsNull(SettlementReviewRefusal(review, en, he));
var changed = UiText.Parse("map.control.depopulated: Empty\n", "strings.en.yaml");
StringAssert.Contains("map.control.depopulated", SettlementReviewRefusal(review, changed, he));
}
[Test]
public void SettlementControlStringsReviewFailsClosed() // R-GATE-002
{
var en = UiText.Parse("a: English\nb: Other\n", "strings.en.yaml");
var he = UiText.Parse("a: עברית\nb: אחר\n", "strings.he.yaml");
Assert.That(SettlementReviewRefusal(null, en, he), Does.Contain("missing or unreadable"));
var empty = ParseSettlementReview("status: sensitivity-reviewed\nstrings: []\n", "fixture");
Assert.That(SettlementReviewRefusal(empty, en, he), Does.Contain("no strings"));
var repeated = ParseSettlementReview(
"status: sensitivity-reviewed\nstrings:\n - { key: a, en: English, he: עברית }\n - { key: a, en: English, he: עברית }\n", "fixture");
Assert.That(SettlementReviewRefusal(repeated, en, he), Does.Contain("repeated key 'a'"));
var emptyKey = ParseSettlementReview("status: sensitivity-reviewed\nstrings:\n - { key: '', en: English, he: עברית }\n", "fixture");
Assert.That(SettlementReviewRefusal(emptyKey, en, he), Does.Contain("empty key"));
var unknown = ParseSettlementReview(
"status: fact-checked\nstrings:\n - { key: a, en: English, he: עברית }\n", "fixture");
Assert.That(SettlementReviewRefusal(unknown, en, he), Does.Contain("unknown status"));
var missing = ParseSettlementReview(
"status: sensitivity-reviewed\nstrings:\n - { key: missing, en: English, he: עברית }\n", "fixture");
Assert.That(SettlementReviewRefusal(missing, en, he), Does.Contain("missing"));
var missingHebrew = ParseSettlementReview(
"status: sensitivity-reviewed\nstrings:\n - { key: a, en: English, he: עברית }\n", "fixture");
Assert.That(SettlementReviewRefusal(missingHebrew, en, UiText.Parse("b: אחר\n", "strings.he.yaml")),
Does.Contain("strings.he.yaml"));
var unreadable = Assert.Throws<TargetInvocationException>(() => ParseSettlementReview("not: [readable", "fixture"));
Assert.IsInstanceOf<InvalidOperationException>(unreadable!.InnerException);
}
[TestCase("capture.fixture")]
[TestCase("map.control.fixture")]
[TestCase("info.control.fixture")]
[TestCase("hud.standing_displaced_places")]
public void SettlementControlStringsReviewRefusesAnOmittedEligibleKey(string omitted) // R-GATE-002
{
var en = UiText.Parse("a: English\n" + omitted + ": Fixture\n", "strings.en.yaml");
var he = UiText.Parse("a: עברית\n" + omitted + ": בדיקה\n", "strings.he.yaml");
var review = ParseSettlementReview(
"status: sensitivity-reviewed\nstrings:\n - { key: a, en: English, he: עברית }\n", "fixture");
StringAssert.Contains(omitted, SettlementReviewRefusal(review, en, he));
}
[Test]
public void TheSettlementControlStringsRefusalJoinsTheShareableGateOnly() // R-GATE-002
{
var t = Type.GetType("Statecraft.Game.EditorTools.Build, Assembly-CSharp-Editor")!;
var gate = t.GetMethod("GateRefusal", BindingFlags.Public | BindingFlags.Static)!;
var args = new object?[] { new[] { "Unity", "-shareable" }, ReviewedContent(), null, false, null, null, "fixture string refusal" };
StringAssert.Contains("fixture string refusal", (string?)gate.Invoke(null, args));
args[0] = new[] { "Unity" };
Assert.IsNull(gate.Invoke(null, args), "a dev build remains ungated");
}
[Test]
public void TheShippedReviewManifestCoversTheWholeSettlementControlSurface() // R-GATE-002
{
var review = ParseSettlementReview(File.ReadAllText(UiPaths.SettlementControlStringsReview), UiPaths.SettlementControlStringsReview);
Assert.AreEqual(ReleaseGate.ReviewedStatus, SettlementReview.GetProperty("Status")!.GetValue(review),
"#2542 added agent-drafted English and Hebrew control strings; the owner's sensitivity review set the status (#2809, 5 November 2026)");
var rows = ((System.Collections.IEnumerable)SettlementReview.GetProperty("Strings")!.GetValue(review)!).Cast<object>();
var rowType = SettlementReview.GetNestedType("Row")!;
var keys = rows.Select(x => (string)rowType.GetProperty("Key")!.GetValue(x)!).ToArray();
CollectionAssert.AreEqual(new[]
{
"capture.intro", "capture.option.raid", "capture.option.occupy", "capture.option.deport",
"capture.about.raid", "capture.about.occupy", "capture.about.deport", "capture.changes",
"capture.changes_none", "capture.caption.attention", "capture.caption.food", "capture.caption.arms",
"capture.caption.score", "capture.delta_attention", "capture.delta_count", "capture.none", "capture.reopen",
"capture.end.intro", "capture.end.option.annex", "capture.end.option.withdraw", "capture.end.about.annex_fled",
"capture.end.about.annex_stayed", "capture.end.about.withdraw", "capture.end.changes", "capture.end.changes_none",
"capture.end.none", "capture.refusal.attention", "capture.refusal.needs_unit", "capture.refusal.no_free_hex",
"capture.refusal.no_one_to_deport", "capture.refusal.already_city", "capture.refusal.not_awaiting",
"capture.refusal.unknown_outcome",
"map.control.awaiting_choice", "map.control.occupied", "map.control.awaiting_end", "map.control.depopulated",
"map.control.annexed", "map.control.lost",
"info.control.awaiting_choice", "info.control.occupied", "info.control.awaiting_end", "info.control.depopulated",
"info.control.annexed", "info.control.lost", "info.control.enemy_held",
"hud.standing_displaced_places",
}, keys);
// A settlement-control key added to either strings file later (U6's dialog, #799's annex words) must join the manifest.
foreach (var file in new[] { UiPaths.Strings, UiPaths.StringsHebrew })
foreach (var key in new YamlDotNet.Serialization.Deserializer().Deserialize<System.Collections.Generic.Dictionary<string, string>>(File.ReadAllText(file)).Keys)
if (IsSettlementControlKey(key))
CollectionAssert.Contains(keys, key, file + ": " + key + " is a settlement-control string, so R-GATE-002's manifest lists it");
}
/// <summary>The real content with its starting forces' rows fact-checked (R-UNIT-006, Q-START-3) and its settlement
/// target rows sensitivity-reviewed (Q-TGT-3 (b), #793), as the owner's checks left them (#1240, #1241, #793), for the
/// tests about the other gates. In memory only, so these tests do not depend on the shipped statuses. Each row's
/// checked_on moves to its latest source check too, as a person's check of the later fields would move it (#2722).</summary>
internal static Content Checked()
{
var c = ContentLoader.Load(Paths.Content);
foreach (var f in c.StartingForces)
{
f.Status = "fact-checked";
f.CheckedOn = f.SourcesChecked.Select(x => x.Checked).Append(f.CheckedOn).OrderBy(x => x, System.StringComparer.Ordinal).Last();
}
foreach (var t in c.SettlementTargets) t.Status = ReleaseGate.ReviewedStatus;
return c;
}
/// <summary>R-UNIT-006, Q-START-3 (#743): a starting force's row that is not fact-checked blocks a shareable build, by name.</summary>
[Test]
public void AShareableBuildWaitsForTheStartingForcesRows()
{
var c = ContentLoader.Load(Paths.Content);
CollectionAssert.IsEmpty(ReleaseGate.StartingForcesUnchecked(c).Select(x => x.Split(':')[0]),
"the owner person-checked the real rows (21 October 2026, #1240), and Etzioni and the 7th after them (#1241, https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6338280840); six got an order target sourced after that check (#2722), and the owner checked those on 6 November 2026 (#2757, \"all approved\"), and Givati's Bayt Jibrin target on 7 November 2026 (#2621)");
foreach (var f in c.StartingForces) f.Status = "to_verify"; // in memory only: the rows as they were before that check
var refusal = Refusal(c);
Assert.IsNotNull(refusal, "a row that is not fact-checked blocks a shareable build");
foreach (var f in c.StartingForces) StringAssert.Contains(f.Row, refusal);
Assert.IsNull(Refusal(ReviewedContent()));
}
/// <summary>Q-TGT-3 (b) (#783, #1274): a settlement target row that is not sensitivity-reviewed blocks a shareable build,
/// by name; a reviewed row does not.</summary>
[Test]
public void AShareableBuildWaitsForTheSettlementTargetsReview()
{
var c = ReviewedContent();
var target = new SettlementTarget { Id = "fixture_target", Status = "draft" };
c.SettlementTargets.Add(target);
StringAssert.Contains("fixture_target", Refusal(c));
target.Status = ReleaseGate.ReviewedStatus;
Assert.IsNull(Refusal(c));
}
/// <summary>R-ALT-011: an unsigned consequence card blocks Unity's shareable-build gate and is named.</summary>
[Test]
public void AShareableBuildWaitsForAnUnsignedConsequenceCard()
{
var c = ReviewedContent();
var card = c.Events.Single(e => e.Id == "jerusalem_demilitarisation_guard");
var signer = card.ReviewedBy;
card.ReviewedBy = "";
StringAssert.Contains(card.Id, Refusal(c));
card.ReviewedBy = signer;
Assert.IsNull(Refusal(c));
}
[Test]
public void AShareableBuildWaitsForTheSensitivityReview()
{
var c = Checked();
Assert.IsNull(Refusal(c), "every shipped sensitive event is reviewed (burma_road_complete: owner, 21 Oct 2026, #791; deport_acre and deport_nazareth: owner, 2 Nov 2026, #2197)");
foreach (var e in c.Events) if (ReleaseGate.SensitiveEvents(c).Contains(e.Id)) e.Status = "fact-checked"; // as before the sign-off
var refusal = Refusal(c);
Assert.IsNotNull(refusal, "an unreviewed sensitive event blocks a shareable build");
foreach (var id in ReleaseGate.SensitiveUnreviewed(c)) StringAssert.Contains(id, refusal);
foreach (var e in c.Events) if (ReleaseGate.SensitiveEvents(c).Contains(e.Id)) e.Status = ReleaseGate.ReviewedStatus; // as the owner's sign-off would
Assert.IsNull(Refusal(c), "all reviewed: the build may be shared");
}
/// <summary>Rereview: the gate applies to every player build made with -shareable (Build.Web and Build.Mac call the same
/// check); without the flag, dev builds stay ungated (web_check needs them).</summary>
[Test]
public void TheShareableFlagGatesEveryPlayerBuild()
{
var t = Type.GetType("Statecraft.Game.EditorTools.Build, Assembly-CSharp-Editor")!;
var gate = t.GetMethod("GateRefusal", BindingFlags.Public | BindingFlags.Static)!;
var c = Checked();
Assert.IsNull(gate.Invoke(null, new object?[] { new[] { "Unity", "-executeMethod", "Statecraft.Game.EditorTools.Build.Mac" }, c, null, false, null, null, ReviewedSettlementControlStrings() }), "a dev build is not gated");
Assert.AreEqual(ReleaseGate.ReviewedStatus, c.Events.Single(e => e.Id == "burma_road_complete").Status, "the owner's review of 21 Oct 2026 (#791)");
Assert.IsNull(gate.Invoke(null, new object?[] { new[] { "Unity", "-shareable" }, c, null, false, null, null, ReviewedSettlementControlStrings() }));
foreach (var e in c.Events) if (e.Id == "reparations_claim") e.Status = "fact-checked";
StringAssert.Contains("reparations_claim", (string?)gate.Invoke(null, new object?[] { new[] { "Unity", "-shareable" }, c, null, false, null, null, ReviewedSettlementControlStrings() }));
var source = System.IO.File.ReadAllText("Assets/Editor/Build.cs");
foreach (var method in new[] { "public static void Web()", "public static void Mac()", "static void StandaloneMono(" })
{
var body = source.Substring(source.IndexOf(method, StringComparison.Ordinal), 400);
StringAssert.Contains("RefuseUnlessShareable()", body, method + " checks the gate first");
}
foreach (var method in new[] { "public static void LinuxMono()", "public static void WindowsMono()" })
StringAssert.Contains("=> StandaloneMono(", source.Substring(source.IndexOf(method, StringComparison.Ordinal), 120), method + " goes through the gated Mono build");
}
/// <summary>#482: Linux and Windows are built from the Mac on Mono (decisions O7, O8). The Standalone backend is one
/// setting for all three desktop targets, so the Mono build must put the committed IL2CPP back afterwards.</summary>
[Test]
public void TheMonoPlayersRestoreTheCommittedBackend()
{
var t = Type.GetType("Statecraft.Game.EditorTools.Build, Assembly-CSharp-Editor")!;
foreach (var name in new[] { "Mac", "LinuxMono", "WindowsMono" })
Assert.IsNotNull(t.GetMethod(name, BindingFlags.Public | BindingFlags.Static), name + " is an -executeMethod target");
var source = System.IO.File.ReadAllText("Assets/Editor/Build.cs");
var start = source.IndexOf("static void StandaloneMono(", StringComparison.Ordinal);
var body = source.Substring(start, source.IndexOf("ExitIfFailed(ok);", start, StringComparison.Ordinal) - start);
StringAssert.Contains("ScriptingImplementation.Mono2x", body);
StringAssert.Contains("finally { ProjectSetup.Apply();", body, "IL2CPP is restored even when the build throws");
Assert.AreEqual(UnityEditor.ScriptingImplementation.IL2CPP,
UnityEditor.PlayerSettings.GetScriptingBackend(UnityEditor.Build.NamedBuildTarget.Standalone), "the committed Standalone backend");
}
// A test fixture only: isolate photo refusals from the separately tested draft event's sensitivity refusal.
static Content ReviewedContent()
{
var c = Checked();
foreach (var e in c.Events)
if (ReleaseGate.SensitiveEvents(c).Contains(e.Id)) e.Status = ReleaseGate.ReviewedStatus;
return c;
}
// Owner ruling 2026-10-11: the event photographs of sensitive events need the
// owner's sensitivity review before a shareable build may carry them. The gate reads the catalog the build ships.
static readonly string[] SensitivePhotos =
{ "altalena", "bernadotte_assassination", "burma_road_complete", "degania_defence", "operation_hiram", "operation_horev", "operation_yoav", "reparations_vote", "ten_days" };
static Statecraft.Game.UI.EventImageCatalog ShippedPhotos()
{
var real = UnityEditor.AssetDatabase.LoadAssetAtPath<Statecraft.Game.UI.EventImageCatalog>("Assets/Resources/EventImageCatalog.asset");
Assert.IsNotNull(real, "the shipped catalog (run EventImageImport.Run)");
return UnityEngine.Object.Instantiate(real);
}
/// <summary>The catalog as it was before the owner's sign-off of 2026-10-11: every sensitive picture unreviewed.</summary>
static void Unreview(Statecraft.Game.UI.EventImageCatalog photos)
{
for (int i = 0; i < photos.entries.Count; i++) { var e = photos.entries[i]; e.sensitivityReviewed = false; photos.entries[i] = e; }
}
/// <summary>The mapping as it was before the owner's sign-off.</summary>
static System.Collections.Generic.IReadOnlyList<Statecraft.Game.UI.EventImageMapping.Row> UnreviewedMapping
{
get { var rows = Mapping; foreach (var r in rows) r.SensitivityReviewed = false; return rows; }
}
[Test]
public void ShareableBuildsWaitForTheSensitivityReviewOfTheEventPhotographs()
{
var t = Type.GetType("Statecraft.Game.EditorTools.Build, Assembly-CSharp-Editor")!;
var gate = t.GetMethod("GateRefusal", BindingFlags.Public | BindingFlags.Static)!;
var c = ReviewedContent();
var photos = ShippedPhotos();
try
{
CollectionAssert.IsEmpty(photos.SensitiveUnreviewed(), "every shipped sensitive photograph is reviewed (burma_road_complete: owner, 21 Oct 2026)");
Assert.IsNull(gate.Invoke(null, new object?[] { new[] { "Unity", "-shareable" }, c, photos, true, Mapping, null, ReviewedSettlementControlStrings() }), "the shipped catalog and mapping may be shared");
Unreview(photos);
CollectionAssert.AreEqual(SensitivePhotos, photos.SensitiveUnreviewed(), "exactly the owner's list");
var refusal = (string?)gate.Invoke(null, new object?[] { new[] { "Unity", "-shareable" }, c, photos, false, null, null, ReviewedSettlementControlStrings() });
Assert.IsNotNull(refusal, "unreviewed sensitive photographs block a shareable build");
foreach (var id in SensitivePhotos) StringAssert.Contains(id, refusal);
StringAssert.Contains("event photographs", refusal);
Assert.IsNull(gate.Invoke(null, new object?[] { new[] { "Unity", "-executeMethod", "Statecraft.Game.EditorTools.Build.Web" }, c, photos, false, null, null, ReviewedSettlementControlStrings() }),
"a dev build still carries them (the owner reviews them in one)");
for (int i = 0; i < photos.entries.Count; i++) // as the owner's sign-off would
{
var e = photos.entries[i]; e.sensitivityReviewed = e.sensitive; photos.entries[i] = e;
}
Assert.IsNull(gate.Invoke(null, new object?[] { new[] { "Unity", "-shareable" }, c, photos, false, null, null, ReviewedSettlementControlStrings() }), "all reviewed: the build may be shared");
}
finally { UnityEngine.Object.DestroyImmediate(photos); }
}
[Test]
public void TheShareableBuildChecksTheShippedCatalog()
{
var source = System.IO.File.ReadAllText("Assets/Editor/Build.cs");
var start = source.IndexOf("static bool RefuseUnlessShareable()", StringComparison.Ordinal);
var body = source.Substring(start, source.IndexOf("\n }\n", start, StringComparison.Ordinal) - start); // the whole method
StringAssert.Contains("EventImageImport.CatalogPath", body, "the gate loads the catalog the build ships");
StringAssert.Contains("File.Exists(EventImageImport.CatalogPath)", body, "a catalog that fails to load is not 'nothing to review'");
StringAssert.Contains("EventImageMapping.Path", body, "the gate cross-checks the mapping");
StringAssert.Contains("SettlementControlStringReview.Refusal(", body, "R-GATE-002: the gate checks the settlement-control strings");
StringAssert.Contains("UiPaths.SettlementControlStringsReview", body, "R-GATE-002: from the shipped manifest");
}
static MethodInfo Gate => Type.GetType("Statecraft.Game.EditorTools.Build, Assembly-CSharp-Editor")!.GetMethod("GateRefusal", BindingFlags.Public | BindingFlags.Static)!;
static System.Collections.Generic.IReadOnlyList<Statecraft.Game.UI.EventImageMapping.Row> Mapping =>
Statecraft.Game.UI.EventImageMapping.Parse(System.IO.File.ReadAllText(Statecraft.Game.UI.EventImageMapping.Path));
static readonly string[] Shareable = { "Unity", "-shareable" };
/// <summary>Review I5: the gate fails closed. A catalog file that exists but did not load refuses, and the sensitive
/// rows of the mapping refuse even when the catalog has none.</summary>
[Test]
public void TheGateFailsClosedWhenTheCatalogDoesNotLoad()
{
var c = ReviewedContent();
var refusal = (string?)Gate.Invoke(null, new object?[] { Shareable, c, null, true, null, null, ReviewedSettlementControlStrings() });
Assert.IsNotNull(refusal, "an existing catalog that did not load is a refusal");
StringAssert.Contains("did not load", refusal);
Assert.IsNull(Gate.Invoke(null, new object?[] { Shareable, c, null, false, null, null, ReviewedSettlementControlStrings() }), "no catalog file and no mapping: no photographs ship");
var fromMapping = (string?)Gate.Invoke(null, new object?[] { Shareable, c, null, true, UnreviewedMapping, null, ReviewedSettlementControlStrings() });
foreach (var id in SensitivePhotos) StringAssert.Contains(id, fromMapping, "the mapping's own sensitive rows refuse");
}
/// <summary>Review I5: a catalog edited by hand (or stale) against the mapping refuses, even when the edit marks every
/// photograph reviewed.</summary>
[Test]
public void TheGateRefusesACatalogThatDoesNotMatchTheMapping()
{
var c = ReviewedContent();
var photos = ShippedPhotos();
try
{
Assert.IsNull(Gate.Invoke(null, new object?[] { Shareable, c, photos, true, Mapping, null, ReviewedSettlementControlStrings() }), "the shipped catalog matches the mapping, all reviewed");
Unreview(photos);
for (int i = 0; i < photos.entries.Count; i++) // a hand edit, not the owner's sign-off
{
var e = photos.entries[i]; e.sensitivityReviewed = e.sensitive; photos.entries[i] = e;
}
Assert.IsNull(Gate.Invoke(null, new object?[] { Shareable, c, photos, true, null, null, ReviewedSettlementControlStrings() }), "the catalog alone would pass");
var refusal = (string?)Gate.Invoke(null, new object?[] { Shareable, c, photos, true, UnreviewedMapping, null, ReviewedSettlementControlStrings() });
Assert.IsNotNull(refusal, "the mapping still says unreviewed");
StringAssert.Contains("does not match", refusal);
foreach (var id in SensitivePhotos) StringAssert.Contains(id, refusal);
var j = photos.entries.FindIndex(e => e.eventId == "maabarot_policy");
var m = photos.entries[j]; m.credit = "someone else"; photos.entries[j] = m;
StringAssert.Contains("maabarot_policy", (string?)Gate.Invoke(null, new object?[] { Shareable, c, photos, true, Mapping, null, ReviewedSettlementControlStrings() }), "a changed credit");
}
finally { UnityEngine.Object.DestroyImmediate(photos); }
}
[Test]
public void TheGateRefusesAStaleHebrewAltInTheCatalog()
{
var photos = ShippedPhotos();
try
{
var j = photos.entries.FindIndex(e => e.eventId == "maabarot_policy");
Assert.GreaterOrEqual(j, 0, "fixture photograph");
var entry = photos.entries[j]; entry.altHe += " ישן"; photos.entries[j] = entry;
var refusal = (string?)Gate.Invoke(null, new object?[] { Shareable, ReviewedContent(), photos, true, Mapping, null, ReviewedSettlementControlStrings() });
Assert.IsNotNull(refusal);
StringAssert.Contains("does not match", refusal);
StringAssert.Contains("maabarot_policy", refusal);
}
finally { UnityEngine.Object.DestroyImmediate(photos); }
}
/// <summary>Review I1: every build writes event-photos.json beside its output, which tools/package_release.py reads
/// (the pictures are packed into the data files, where the packager cannot see them).</summary>
[Test]
public void EveryBuildWritesThePhotoManifestForThePackager()
{
var t = Type.GetType("Statecraft.Game.EditorTools.Build, Assembly-CSharp-Editor")!;
Assert.AreEqual("event-photos.json", t.GetField("PhotoManifestName", BindingFlags.Public | BindingFlags.Static)!.GetValue(null));
var json = t.GetMethod("PhotoManifestJson", BindingFlags.Public | BindingFlags.Static)!;
var photos = ShippedPhotos();
try
{
var dev = (string)json.Invoke(null, new object?[] { photos, false })!;
StringAssert.IsMatch("\"shareable\":\\s*false", dev);
foreach (var id in SensitivePhotos)
StringAssert.IsMatch($"\"event_id\":\\s*\"{id}\",\\s*\"sensitive\":\\s*true,\\s*\"sensitivity_reviewed\":\\s*true", dev); // burma_road_complete: owner, 21 Oct 2026
Assert.AreEqual(29, System.Text.RegularExpressions.Regex.Matches(dev, "\"event_id\"").Count); // first_new_yishuv came with #380, absorb_immigrants with #739, degania_defence with #1565, reparations_vote with #1564
StringAssert.IsMatch("\"shareable\":\\s*true", (string)json.Invoke(null, new object?[] { photos, true })!);
StringAssert.IsMatch("\"photos\":\\s*\\[\\s*\\]", (string)json.Invoke(null, new object?[] { null, true })!);
}
finally { UnityEngine.Object.DestroyImmediate(photos); }
var source = System.IO.File.ReadAllText("Assets/Editor/Build.cs");
foreach (var method in new[] { "public static void Web()", "public static void Mac()" })
{
var body = source.Substring(source.IndexOf(method, StringComparison.Ordinal), 900);
StringAssert.Contains("WritePhotoManifest(", body, method + " writes the manifest");
}
}
}