Stundenplan: Wochenraster, Wochennavigation, Ferien/Feiertage (Kapitel 4.3)
Neuer Stundenplan mit "Heute"-Standardansicht (Tagesliste unten angedockt, gruppenübergreifendes Wochenraster mit Fach/Klasse/Raum/Thema, Vor-/Zurück- Navigation zwischen Kalenderwochen) und separatem Bearbeiten-Raster für die wöchentliche Zuordnung. Badges für Ferien-/Klausur-Nähe und ausgegraute Ferientage direkt im Plan statt einer separaten Liste. Ferien-/Feiertage- Pflege (Bundesland, Schulferien) sitzt jetzt in den Einstellungen statt im Stundenplan selbst. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
using LehrerApp.Core.Models;
|
||||
using LehrerApp.Core.Services;
|
||||
using Xunit;
|
||||
|
||||
namespace LehrerApp.Tests;
|
||||
|
||||
public sealed class PublicHolidayServiceTests
|
||||
{
|
||||
private readonly PublicHolidayService _service = new();
|
||||
|
||||
[Theory]
|
||||
[InlineData(2023, "2023-04-09")]
|
||||
[InlineData(2024, "2024-03-31")]
|
||||
[InlineData(2025, "2025-04-20")]
|
||||
[InlineData(2026, "2026-04-05")]
|
||||
[InlineData(2027, "2027-03-28")]
|
||||
public void GetHolidays_Ostermontag_LiegtEinenTagNachDemBekanntenOstersonntag(int year, string easterSundayIso)
|
||||
{
|
||||
var easterSunday = DateOnly.Parse(easterSundayIso);
|
||||
var holidays = _service.GetHolidays(year, GermanState.NW);
|
||||
|
||||
Assert.Contains(holidays, h => h.Name == "Ostermontag" && h.Date == easterSunday.AddDays(1));
|
||||
Assert.Contains(holidays, h => h.Name == "Karfreitag" && h.Date == easterSunday.AddDays(-2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetHolidays_AlleBundeslaender_EnthaltenDieBundesweitenFeiertage()
|
||||
{
|
||||
foreach (var state in Enum.GetValues<GermanState>())
|
||||
{
|
||||
var holidays = _service.GetHolidays(2026, state);
|
||||
Assert.Contains(holidays, h => h.Date == new DateOnly(2026, 1, 1)); // Neujahr
|
||||
Assert.Contains(holidays, h => h.Date == new DateOnly(2026, 5, 1)); // Tag der Arbeit
|
||||
Assert.Contains(holidays, h => h.Date == new DateOnly(2026, 10, 3)); // Tag der Deutschen Einheit
|
||||
Assert.Contains(holidays, h => h.Date == new DateOnly(2026, 12, 25));
|
||||
Assert.Contains(holidays, h => h.Date == new DateOnly(2026, 12, 26));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetHolidays_Fronleichnam_NurInDenZustaendigenBundeslaendern()
|
||||
{
|
||||
var nrw = _service.GetHolidays(2026, GermanState.NW);
|
||||
var berlin = _service.GetHolidays(2026, GermanState.BE);
|
||||
|
||||
Assert.Contains(nrw, h => h.Name == "Fronleichnam");
|
||||
Assert.DoesNotContain(berlin, h => h.Name == "Fronleichnam");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetHolidays_Reformationstag_NurInDenZustaendigenBundeslaendern()
|
||||
{
|
||||
var sachsen = _service.GetHolidays(2026, GermanState.SN);
|
||||
var bayern = _service.GetHolidays(2026, GermanState.BY);
|
||||
|
||||
Assert.Contains(sachsen, h => h.Name == "Reformationstag");
|
||||
Assert.DoesNotContain(bayern, h => h.Name == "Reformationstag");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetHolidays_SindNachDatumSortiert()
|
||||
{
|
||||
var holidays = _service.GetHolidays(2026, GermanState.BY);
|
||||
|
||||
Assert.Equal(holidays.OrderBy(h => h.Date).Select(h => h.Date), holidays.Select(h => h.Date));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using LehrerApp.Core.Models;
|
||||
using LehrerApp.Core.Services;
|
||||
using Xunit;
|
||||
|
||||
namespace LehrerApp.Tests;
|
||||
|
||||
public sealed class SchoolCalendarSettingsServiceTests
|
||||
{
|
||||
[Fact]
|
||||
public void NeueKonfiguration_HatNordrheinWestfalenAlsStandard()
|
||||
{
|
||||
using var temp = new TempAppData();
|
||||
var service = new SchoolCalendarSettingsService(temp.Path);
|
||||
|
||||
Assert.Equal(GermanState.NW, service.State);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetState_WirdUeberNeueInstanzHinwegPersistiert()
|
||||
{
|
||||
using var temp = new TempAppData();
|
||||
new SchoolCalendarSettingsService(temp.Path).SetState(GermanState.BY);
|
||||
|
||||
var second = new SchoolCalendarSettingsService(temp.Path);
|
||||
|
||||
Assert.Equal(GermanState.BY, second.State);
|
||||
}
|
||||
|
||||
private sealed class TempAppData : IDisposable
|
||||
{
|
||||
public string Path { get; } = System.IO.Path.Combine(
|
||||
System.IO.Path.GetTempPath(), $"lehrerapp-schoolcal-tests-{Guid.NewGuid():N}");
|
||||
|
||||
public TempAppData() => Directory.CreateDirectory(Path);
|
||||
public void Dispose() { if (Directory.Exists(Path)) Directory.Delete(Path, recursive: true); }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user