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:
@@ -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)}"));
|
||||
|
||||
Reference in New Issue
Block a user