Add school dress rules tab in Management with tests.
This commit is contained in:
@@ -152,6 +152,63 @@ public class AppropriatenessSimulationTests
|
||||
Assert.Equal(0, BrightWornCount(school));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PendingNoBright_AfterMorning_RemovesBrightWornColours()
|
||||
{
|
||||
using var school = Open(TuesdayMorning, seed: 31);
|
||||
MorningDress.Apply(school);
|
||||
school.DressRules = school.DressRules with
|
||||
{
|
||||
PendingStudents = new DressRulePair(FormPolicies.Regular, ColorPolicies.Free),
|
||||
};
|
||||
AdvanceMorning(school);
|
||||
Assert.True(BrightWornCount(school) > 0, "Free colours should allow at least one bright item.");
|
||||
|
||||
school.DressRules = school.DressRules with
|
||||
{
|
||||
PendingStudents = new DressRulePair(FormPolicies.Regular, ColorPolicies.NoBright),
|
||||
};
|
||||
AdvanceMorning(school);
|
||||
Assert.Equal(0, BrightWornCount(school));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WhiteTopBlackBottom_AfterMorning_WhiteShirtsOnStudents()
|
||||
{
|
||||
using var school = Open(TuesdayMorning, seed: 31);
|
||||
MorningDress.Apply(school);
|
||||
school.DressRules = school.DressRules with
|
||||
{
|
||||
PendingStudents = new DressRulePair(FormPolicies.Regular, ColorPolicies.WhiteTopBlackBottom),
|
||||
};
|
||||
AdvanceMorning(school);
|
||||
|
||||
var checkedAny = false;
|
||||
foreach (var pupil in school.Roster!.People.Where(person => person.IsStudent))
|
||||
{
|
||||
foreach (var item in pupil.Items.Where(row => row.Location == ItemLocations.Worn))
|
||||
{
|
||||
if (!school.Catalog!.Things[item.Def].Layers.Any(layer =>
|
||||
layer.Equals(ApparelLayers.Top, StringComparison.Ordinal)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
checkedAny = true;
|
||||
Assert.Equal("White", item.Color);
|
||||
}
|
||||
}
|
||||
|
||||
Assert.True(checkedAny, "Expected at least one pupil with a top-layer shirt.");
|
||||
}
|
||||
|
||||
private static void AdvanceMorning(School school)
|
||||
{
|
||||
var before = school.Clock.Time;
|
||||
school.Clock.JumpTo(before.Date.AddDays(1).AddHours(6));
|
||||
ApparelWear.Apply(school, gameMinutes: 0, before);
|
||||
}
|
||||
|
||||
private static int BrightWornCount(School school)
|
||||
{
|
||||
var count = 0;
|
||||
|
||||
Reference in New Issue
Block a user