Files
h-school/tests/HSchool.Schedule.Tests/TimetableClockTests.cs
T
Leonid Pershin cad3068bac
ci / server (push) Failing after 3m53s
ci / client (push) Successful in 15s
Update wire protocol to version 6 and enhance timetable functionality
- Bumped the wire protocol version to 6, reflecting changes in the communication structure.
- Expanded the timetable API with new endpoints for fetching and managing lesson schedules, including `GET /api/schools/{id}/timetable` and `POST /api/schools/{id}/timetable/pin`.
- Updated the protocol documentation to include detailed descriptions of the new timetable features and message structures.
- Enhanced the client-side implementation to support the new timetable functionalities, including lesson pinning and unpinning.
- Revised server-side logic to handle timetable operations and ensure proper integration with existing school management features.
- Added tests to validate the new timetable functionalities and ensure robustness in handling lesson data.
2026-08-19 10:05:05 +03:00

58 lines
1.6 KiB
C#

using HSchool.Content;
namespace HSchool.Schedule.Tests;
public class TimetableClockTests
{
private readonly DefCatalog _catalog = Fixtures.Catalog();
private static readonly LessonPlacement MathOnTuesdayPeriod3 = new(
"c5A",
"Mathematics",
"t1",
"classroom-101",
Day: 1,
Period: 3);
[Fact]
public void TuesdayTenTwenty_IsThePlacedLesson()
{
var table = new Timetable([MathOnTuesdayPeriod3], []);
var occurring = TimetableClock.OccurringAt(
table,
_catalog,
new DateTime(2012, 4, 3, 10, 20, 0, DateTimeKind.Utc),
weekDays: 5);
Assert.Equal([MathOnTuesdayPeriod3], occurring);
}
[Fact]
public void TuesdayTenFifteen_IsABreakAndEmpty()
{
var table = new Timetable([MathOnTuesdayPeriod3], []);
var occurring = TimetableClock.OccurringAt(
table,
_catalog,
new DateTime(2012, 4, 3, 10, 15, 0, DateTimeKind.Utc),
weekDays: 5);
Assert.Empty(occurring);
Assert.Equal(
new OccupancyKey(new DateOnly(2012, 4, 3), DaySlotKind.Break, 2),
TimetableClock.Key(_catalog, new DateTime(2012, 4, 3, 10, 15, 0, DateTimeKind.Utc), 5));
}
[Fact]
public void Saturday_IsEmpty()
{
var table = new Timetable([MathOnTuesdayPeriod3], []);
var occurring = TimetableClock.OccurringAt(
table,
_catalog,
new DateTime(2012, 4, 7, 10, 20, 0, DateTimeKind.Utc),
weekDays: 5);
Assert.Empty(occurring);
}
}