A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
fix(ui): WhyPresenter.Show is internal (InternalsVisibleTo the edit-mode tests), guard test counts every new Cause(
eyalgolan8e755e3d8800
diff --git a/unity/Assets/Scripts/AssemblyInfo.cs b/unity/Assets/Scripts/AssemblyInfo.csnew file mode 100644index 000000000..d5ff651b7--- /dev/null+++ b/unity/Assets/Scripts/AssemblyInfo.cs@@ -0,0 +1,2 @@+// The edit-mode tests may use internal members (for example WhyPresenter.Show); nothing else outside Statecraft.Game may.+[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Statecraft.Tests.EditMode")]diff --git a/unity/Assets/Scripts/AssemblyInfo.cs.meta b/unity/Assets/Scripts/AssemblyInfo.cs.metanew file mode 100644index 000000000..0f0d7a80f--- /dev/null+++ b/unity/Assets/Scripts/AssemblyInfo.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: 23539285229df469b9f7bb09c1df8c9c\ No newline at end of filediff --git a/unity/Assets/Scripts/UI/WhyPresenter.cs b/unity/Assets/Scripts/UI/WhyPresenter.csindex ec34b43e5..caccd3300 100644--- a/unity/Assets/Scripts/UI/WhyPresenter.cs+++ b/unity/Assets/Scripts/UI/WhyPresenter.cs@@ -27,9 +27,9 @@ namespace Statecraft.Game.UI/// <summary>Shows the session's last turn. Does nothing when that same result is already on screen.</summary>public void Render() => Show(bridge.Session.Last);- /// <summary>Shows <paramref name="last"/> (a turn's result, or null for "nothing yet"). The same session and result+ /// <summary>Test seam (internal; the tests see it through InternalsVisibleTo). Shows <paramref name="last"/> (a turn's result, or null for "nothing yet"). The same session and result/// as last time are not rebuilt; a new turn, a new game or a loaded save are.</summary>- public void Show(StepResult? last)+ internal void Show(StepResult? last){if (shownSession == bridge.Session && shown == last && screen.Q<ScrollView>("why-rows").childCount > 0) return;shownSession = bridge.Session; shown = last;diff --git a/unity/Assets/Tests/EditMode/WhyScreenTests.cs b/unity/Assets/Tests/EditMode/WhyScreenTests.csindex 0d16b357a..70782b9bf 100644--- a/unity/Assets/Tests/EditMode/WhyScreenTests.cs+++ b/unity/Assets/Tests/EditMode/WhyScreenTests.cs@@ -99,9 +99,15 @@ public class WhyScreenTests{var text = Text;var found = new System.Collections.Generic.SortedSet<string>();+ int literal = 0, all = 0;foreach (var f in System.IO.Directory.GetFiles(System.IO.Path.Combine(Paths.RepoRoot, "sim", "Statecraft.Sim"), "*.cs"))- foreach (System.Text.RegularExpressions.Match m in System.Text.RegularExpressions.Regex.Matches(System.IO.File.ReadAllText(f), "new Cause\\(\"([a-z_]+)\""))- found.Add(m.Groups[1].Value);+ {+ var source = System.IO.File.ReadAllText(f);+ foreach (System.Text.RegularExpressions.Match m in System.Text.RegularExpressions.Regex.Matches(source, "new Cause\\(\"([a-z_]+)\""))+ { found.Add(m.Groups[1].Value); literal++; }+ all += System.Text.RegularExpressions.Regex.Matches(source, "new\\s+Cause\\s*\\(").Count;+ }+ Assert.AreEqual(all, literal, "every 'new Cause(' must name its system as a plain literal, or this scan cannot see it");Assert.Greater(found.Count, 5, "the scan found the sim's causes");foreach (var sys in found){