This commit is contained in:
Leonid Pershin
2026-08-18 23:51:10 +03:00
parent d8f8db6a48
commit 65feda3756
50 changed files with 1485 additions and 224 deletions
+16 -5
View File
@@ -47,10 +47,7 @@ internal static class Fixtures
Building = "main",
Floor = "floor-1",
Label = $"{101 + i}",
Slots =
[
new SlotFill { Key = "studentDesks", Thing = "StudentDesk", Count = desks },
],
Seats = desks,
};
}
@@ -72,7 +69,7 @@ internal static class Fixtures
Building = "main",
Floor = "floor-1",
Label = "101",
Slots = [new SlotFill { Key = "studentDesks", Thing = "StudentDesk", Count = 1 }],
Seats = 1,
},
};
@@ -84,6 +81,20 @@ internal static class Fixtures
return new MapLayout { Rooms = rooms };
}
public static MapLayout VanillaMap()
{
var root = Path.Combine(AppContext.BaseDirectory, "vanilla");
var map = CatalogLoader.LastDefaultMap(
[CatalogLoader.CorePackId],
PackDocuments.FromDirectory(CatalogLoader.CorePackId, root));
if (map is null)
{
throw new InvalidOperationException("Vanilla default map is missing.");
}
return map;
}
public static Roster Generate(MapLayout map, int seed = SchoolSeed) =>
RosterGenerator.Generate(Catalog(), map, seed, "Slavic", AsOf);
@@ -55,7 +55,7 @@ public class RosterBrowserTests
[Fact]
public void ParentFilter_IncludesStaffWhoAreAlsoParents()
{
var roster = Fixtures.Generate(Fixtures.Classrooms(4));
var roster = Fixtures.Generate(Fixtures.VanillaMap());
var page = RosterBrowser.Apply(
roster,
Fixtures.AsOf,
@@ -104,7 +104,7 @@ public class RosterGeneratorTests
[Fact]
public void SomeStaffAreAlsoParents()
{
var roster = Fixtures.Generate(Fixtures.Classrooms(4));
var roster = Fixtures.Generate(Fixtures.VanillaMap());
Assert.Contains(roster.People, person => person.IsStaff && person.IsParent);
}
@@ -122,7 +122,9 @@ public class RosterGeneratorTests
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");
Assert.DoesNotContain(demand.Staff, opening => opening.Position == "Teacher");
Assert.DoesNotContain(demand.Staff, opening => opening.RoomId == "computer-lab");
Assert.Contains(demand.Staff, opening => opening.RoomId == "library" && opening.Position == "Librarian");
}
[Fact]