Lock slice-2 filters and the staff-parent intake path later slices left untested.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 14:53:56 +03:00
co-authored by Cursor
parent d0a8d4a075
commit c2e01f09d3
2 changed files with 110 additions and 1 deletions
@@ -116,6 +116,43 @@ public class YearlyIntakeTests
person => Assert.False(person.IsParent));
}
/// <summary>
/// Slice 3 stopped generating staff, so the "unless they work here" branch of the test above
/// is vacuously empty. Hire still marks a parent <c>IsStaff</c>; intake must not drop them
/// with the graduates' civilian co-parent.
/// </summary>
[Fact]
public void StaffParentOfOnlyGraduates_StaysAfterIntake()
{
var map = Fixtures.Classrooms(4);
var catalog = Fixtures.Catalog();
var generated = Fixtures.Generate(map);
var graduating = generated.Classes
.Where(schoolClass => schoolClass.Year == 4)
.SelectMany(schoolClass => schoolClass.PupilIds)
.ToHashSet(StringComparer.Ordinal);
var family = generated.Families.First(candidate =>
candidate.ChildIds.Count > 0
&& candidate.ChildIds.All(id => graduating.Contains(id)));
var staffId = family.ParentIds[0];
var civilians = family.ParentIds.Skip(1).ToArray();
var before = generated with
{
People = generated.People
.Select(person => person.Id.Equals(staffId, StringComparison.Ordinal)
? person with { IsStaff = true, Position = "Librarian" }
: person)
.ToArray(),
};
var after = YearlyIntake.Apply(catalog, before, Fixtures.SchoolSeed, "Russia", September);
var stayed = Assert.Single(after.People, person => person.Id == staffId);
Assert.True(stayed.IsStaff);
Assert.False(stayed.IsParent);
Assert.All(civilians, id => Assert.DoesNotContain(after.People, person => person.Id == id));
}
private static string Snapshot(Roster roster) =>
string.Join('\n', roster.People.Select(person =>
$"{person.Id}|{person.FamilyId}|{person.IsStudent}|{person.IsStaff}|{person.IsParent}|{person.ClassId}|{person.Name.Full}|{Skills(person)}"));