using LehrerApp.Core.Models; using Xunit; namespace LehrerApp.Tests; /// Tests für 3.1.3 (Aspekt-Typen Scale3/Binary/Points): ParticipationRatingScale definiert die /// Rohwerte je Typ und ihre Normierung auf die gemeinsame -2..+2-Achse für die Mitarbeitsnote (3.2). public sealed class ParticipationRatingScaleTests { [Fact] public void Steps_Scale5_LiefertFuenfStufenAufDerMinus2Bis2Achse() { var steps = ParticipationRatingScale.Steps(AspectValueType.Scale5); Assert.Equal([-2, -1, 0, 1, 2], steps.Select(s => s.Value)); } [Fact] public void Steps_Scale3_LiefertDreiStufenAufDerselbenAchse() { var steps = ParticipationRatingScale.Steps(AspectValueType.Scale3); Assert.Equal([-2, 0, 2], steps.Select(s => s.Value)); } [Fact] public void Steps_Binary_LiefertNurDieBeidenExtremwerte() { var steps = ParticipationRatingScale.Steps(AspectValueType.Binary); Assert.Equal([-2, 2], steps.Select(s => s.Value)); } [Fact] public void Steps_Points_LiefertKeineFestenStufen() { Assert.Empty(ParticipationRatingScale.Steps(AspectValueType.Points)); } [Fact] public void DisplayLabel_OhneWert_ZeigtPlatzhalter() { Assert.Equal("·", ParticipationRatingScale.DisplayLabel(AspectValueType.Scale5, null)); } [Fact] public void DisplayLabel_Points_ZeigtRohenZahlenwert() { Assert.Equal("3", ParticipationRatingScale.DisplayLabel(AspectValueType.Points, 3)); } [Theory] [InlineData(0, 4, -2.0)] [InlineData(2, 4, 0.0)] [InlineData(4, 4, 2.0)] [InlineData(1, 4, -1.0)] public void Normalize_Points_BildetLinearAufDieMinus2Bis2AchseAb(int value, int maxPoints, double expected) { Assert.Equal(expected, ParticipationRatingScale.Normalize(AspectValueType.Points, value, maxPoints)); } [Fact] public void Normalize_Points_KappteAusserhalbDesBereichsLiegendeWerte() { Assert.Equal(2.0, ParticipationRatingScale.Normalize(AspectValueType.Points, 99, 4)); Assert.Equal(-2.0, ParticipationRatingScale.Normalize(AspectValueType.Points, -5, 4)); } [Fact] public void Normalize_Points_OhneMaxPoints_WertetNeutralStattDurchNullZuTeilen() { Assert.Equal(0.0, ParticipationRatingScale.Normalize(AspectValueType.Points, 3, 0)); } [Theory] [InlineData(AspectValueType.Scale5)] [InlineData(AspectValueType.Scale3)] [InlineData(AspectValueType.Binary)] public void Normalize_NichtPunkteTypen_LiegenBereitsAufDerAchse(AspectValueType type) { Assert.Equal(1.0, ParticipationRatingScale.Normalize(type, 1, maxPoints: 5)); } }