namespace HSchool.Content.Tests; public class VanillaCoreTests { [Fact] public void CoreDefaultMap_PassesValidation() { var root = Path.Combine(AppContext.BaseDirectory, "vanilla"); Assert.True(Directory.Exists(root), $"Vanilla core pack was not copied to {root}."); var documents = PackDocuments.FromDirectory(CatalogLoader.CorePackId, root); var catalog = new CatalogLoader().Load([CatalogLoader.CorePackId], documents); var map = CatalogLoader.LastDefaultMap([CatalogLoader.CorePackId], documents); Assert.NotNull(map); MapValidator.Validate(map, catalog); Assert.Equal("SchoolYard", catalog.Territories["SchoolYard"].DefName); Assert.True(catalog.Rooms["Corridor"].Slots.Count == 0); Assert.Equal(["Principal"], catalog.PositionsFor(DefKind.Room, "PrincipalsOffice")); Assert.Equal("Кабинет директора", catalog.Label("ru", catalog.Rooms["PrincipalsOffice"])); Assert.Equal("Principal's office", catalog.Label("en", catalog.Rooms["PrincipalsOffice"])); Assert.Equal(["Sit"], catalog.Things["DirectorsChair"].Actions); Assert.True(catalog.Buildings.ContainsKey("GymBuilding")); Assert.True(catalog.Rooms.ContainsKey("Classroom")); Assert.Equal("Класс", catalog.Label("ru", catalog.Rooms["Classroom"])); Assert.Equal(["Teacher"], catalog.PositionsFor(DefKind.Room, "Classroom")); Assert.Equal(1, catalog.Things["StudentDesk"].PupilSlots); Assert.Equal(1, catalog.Things["Computer"].PupilSlots); Assert.Equal(0, catalog.Things["Desk"].PupilSlots); Assert.Equal(0, catalog.Things["Chair"].PupilSlots); Assert.Contains(catalog.Rooms["Classroom"].Slots, slot => slot.Key == "teacherChair" && slot.Thing == "Chair"); Assert.Equal(16, catalog.Rooms["Classroom"].Slots.Single(slot => slot.Key == "studentDesks").Count); Assert.Equal(2, map.Buildings.Count); Assert.True(map.Rooms.Count >= 18, "Vanilla layout should look like a small school, not a stub."); Assert.Contains(map.Rooms, room => room.Id == "classroom-1a" && room.Label == "1A"); Assert.Equal( 16, map.Rooms.Single(room => room.Id == "classroom-1a").Slots.Single(slot => slot.Key == "studentDesks").Count); Assert.Contains( map.Rooms.Single(room => room.Id == "classroom-1a").Slots, slot => slot.Key == "teacherChair" && slot.Thing == "Chair"); } }