Fix PE change-clothes interruption and post-PE mode detection.
Add appropriateness tests for staging PE kit, wearing form before gym, and returning to everyday clothes after the lesson.
This commit is contained in:
@@ -55,6 +55,51 @@ public class AppropriatenessSimulationTests
|
||||
item => item.Location == ItemLocations.Worn && item.Def == "FurCoat");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MorningDress_StagesPeKitForTodaysLesson()
|
||||
{
|
||||
var (school, pupilId) = StaffedPeClass();
|
||||
using (school)
|
||||
{
|
||||
MorningDress.Apply(school);
|
||||
var person = school.Roster!.People.Single(item => item.Id == pupilId);
|
||||
Assert.Contains(
|
||||
person.Items,
|
||||
item => item.Def is "PeShirt" or "PeShorts"
|
||||
&& item.Location is ItemLocations.Locker or ItemLocations.Bag);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PeBreak_CompletesChangeBeforeLesson()
|
||||
{
|
||||
var (school, pupilId) = StaffedPeClass();
|
||||
using (school)
|
||||
{
|
||||
MorningDress.Apply(school);
|
||||
AdvanceTo(school, new DateTime(2012, 4, 3, 9, 30, 0, DateTimeKind.Utc));
|
||||
var person = school.Roster!.People.Single(item => item.Id == pupilId);
|
||||
Assert.Contains(
|
||||
person.Items,
|
||||
item => item.Location == ItemLocations.Worn && item.Def == "PeShirt");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AfterPeBreak_ModeExpectsEveryday()
|
||||
{
|
||||
var (school, pupilId) = StaffedPeClass();
|
||||
using (school)
|
||||
{
|
||||
MorningDress.Apply(school);
|
||||
AdvanceTo(school, new DateTime(2012, 4, 3, 10, 12, 0, DateTimeKind.Utc));
|
||||
var person = school.Roster!.People.Single(item => item.Id == pupilId);
|
||||
var schoolClass = school.Roster.Classes.First(row => row.PupilIds.Contains(pupilId));
|
||||
Assert.Equal(ApparelMode.Everyday, ApparelPresence.ModeAt(school, person, schoolClass));
|
||||
Assert.True(ApparelDresser.CurrentIssues(school, person, ApparelMode.Everyday).HasFlag(ApparelIssue.PeForbidden));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PeBreak_PupilReachesOwnChangingRoom()
|
||||
{
|
||||
@@ -71,6 +116,38 @@ public class AppropriatenessSimulationTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PeLesson_WearsPeThenReturnsToEveryday()
|
||||
{
|
||||
var (school, pupilId) = StaffedPeClass();
|
||||
using (school)
|
||||
{
|
||||
MorningDress.Apply(school);
|
||||
AdvanceTo(school, new DateTime(2012, 4, 3, 9, 35, 0, DateTimeKind.Utc));
|
||||
var person = school.Roster!.People.Single(item => item.Id == pupilId);
|
||||
Assert.Contains(
|
||||
person.Items,
|
||||
item => item.Location == ItemLocations.Worn && item.Def == "PeShirt");
|
||||
Assert.Contains(
|
||||
person.Items,
|
||||
item => item.Location == ItemLocations.Worn && item.Def == "PeShorts");
|
||||
Assert.DoesNotContain(
|
||||
person.Items,
|
||||
item => item.Location == ItemLocations.Worn
|
||||
&& item.Def is "Shirt" or "TShirt" or "Dress");
|
||||
|
||||
AdvanceTo(school, new DateTime(2012, 4, 3, 10, 25, 0, DateTimeKind.Utc));
|
||||
person = school.Roster.People.Single(item => item.Id == pupilId);
|
||||
Assert.DoesNotContain(
|
||||
person.Items,
|
||||
item => item.Location == ItemLocations.Worn && item.Def == "PeShirt");
|
||||
Assert.Contains(
|
||||
person.Items,
|
||||
item => item.Location == ItemLocations.Worn
|
||||
&& item.Def is "Shirt" or "TShirt" or "Dress" or "Skirt" or "Pants" or "Jeans" or "Trousers");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Boy_DoesNotEnterGirlsChangingRoom()
|
||||
{
|
||||
@@ -201,6 +278,7 @@ public class AppropriatenessSimulationTests
|
||||
[
|
||||
new LessonPlacement(schoolClass.Id, "Mathematics", "t1", schoolClass.RoomId, Day: 1, Period: 1),
|
||||
new LessonPlacement(schoolClass.Id, "PhysicalEducation", "t2", "gym-hall", Day: 1, Period: 2),
|
||||
new LessonPlacement(schoolClass.Id, "Mathematics", "t1", schoolClass.RoomId, Day: 1, Period: 3),
|
||||
],
|
||||
[]));
|
||||
school.ConfigurePresence(weekDays: 5, maxDecisionsPerTick: 10_000);
|
||||
|
||||
Reference in New Issue
Block a user