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); } } }