Enhance school simulation and management by integrating roster functionality, allowing for the installation and persistence of student and staff data. Update the school architecture to include a roster alongside existing components, ensuring proper validation against map layouts. Revise room definitions to support homeroom designations and update related tests to validate new functionalities and ensure robustness in roster handling.
This commit is contained in:
@@ -90,6 +90,37 @@ public class RosterGeneratorTests
|
||||
Assert.Contains(roster.People, person => person.IsStaff && person.IsParent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void VanillaMap_HasElevenHomeroomsNotTheComputerLab()
|
||||
{
|
||||
var catalog = Fixtures.Catalog();
|
||||
var root = Path.Combine(AppContext.BaseDirectory, "vanilla");
|
||||
var map = CatalogLoader.LastDefaultMap(
|
||||
[CatalogLoader.CorePackId],
|
||||
PackDocuments.FromDirectory(CatalogLoader.CorePackId, root));
|
||||
Assert.NotNull(map);
|
||||
|
||||
var demand = SchoolDemand.From(catalog, map);
|
||||
Assert.Equal(11, demand.Classes.Count);
|
||||
Assert.Equal(11 * 16, demand.Seats.Count);
|
||||
Assert.DoesNotContain(demand.Classes, schoolClass => schoolClass.RoomId == "computer-lab");
|
||||
Assert.Contains(demand.Staff, opening => opening.RoomId == "computer-lab" && opening.Position == "Teacher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RosterJson_RoundTripsAGeneratedRoster()
|
||||
{
|
||||
var roster = Fixtures.Generate(Fixtures.Classrooms(1));
|
||||
var json = RosterJson.Serialize(RosterDocument.From(7, roster));
|
||||
var loaded = RosterJson.Parse(json).ToRoster();
|
||||
|
||||
Assert.Equal(roster.People.Count, loaded.People.Count);
|
||||
Assert.Equal(roster.People[0].Name.Given, loaded.People[0].Name.Given);
|
||||
Assert.Equal(roster.People[0].Name.SurnameCases.Gen, loaded.People[0].Name.SurnameCases.Gen);
|
||||
Assert.True(RosterFit.Matches(loaded, SchoolDemand.From(Fixtures.Catalog(), Fixtures.Classrooms(1))));
|
||||
Assert.False(RosterFit.Matches(loaded, SchoolDemand.From(Fixtures.Catalog(), Fixtures.Classrooms(2))));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Assembly_DoesNotReferenceArchAspNetOrSockets()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user