using LehrerApp.Core.Models; using LehrerApp.Desktop.ViewModels.Groups; using Xunit; namespace LehrerApp.Desktop.Tests; /// Nutzer-Feedback: Kompetenzen je Sitzung von Hand zu bewerten ist zu aufwendig - eine Schätzung /// aus dem allgemeinen Mitarbeit-Durchschnitt ersetzt die manuelle Erfassung im Regelfall. public sealed class ParticipationCompetencyEstimateTests { private static readonly AspectColumnDef Quality = new(new ParticipationAspect { Key = "quality", ValueType = AspectValueType.Scale5 }); private static readonly AspectColumnDef Quantity = new(new ParticipationAspect { Key = "quantity", ValueType = AspectValueType.Scale5 }); private static readonly AspectColumnDef Points = new(new ParticipationAspect { Key = "points", ValueType = AspectValueType.Points, MaxPoints = 4 }); [Fact] public void Estimate_OhneBewertungen_LiefertNull() { var estimate = ParticipationCompetencyEstimate.Estimate([], [Quality], null); Assert.Null(estimate); } [Fact] public void Estimate_MittelwertMehrererAspekte_RundetAufNaechstenSchritt() { var ratings = new List { new() { Key = "quality", Value = 1 }, new() { Key = "quantity", Value = 2 }, }; var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Quality, Quantity], null); Assert.Equal(2, estimate); // Mittelwert 1.5 -> AwayFromZero gerundet auf 2 } [Fact] public void Estimate_Spitzentag_HebtDieSchaetzungAn() { var ratings = new List { new() { Key = "quality", Value = 0 } }; var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Quality], DayHighlightKind.Standout); Assert.Equal(1, estimate); } [Fact] public void Estimate_Schlaftag_SenktDieSchaetzung() { var ratings = new List { new() { Key = "quality", Value = 0 } }; var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Quality], DayHighlightKind.Sleepy); Assert.Equal(-1, estimate); } [Fact] public void Estimate_SchlechterTag_SenktDieSchaetzungGleichWieSchlaftag() { var ratings = new List { new() { Key = "quality", Value = 0 } }; var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Quality], DayHighlightKind.Rough); Assert.Equal(-1, estimate); } [Fact] public void Estimate_KapptAufDenGueltigenBereich() { var ratings = new List { new() { Key = "quality", Value = 2 } }; var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Quality], DayHighlightKind.Standout); Assert.Equal(2, estimate); // 2 + 1 würde 3 ergeben, wird auf 2 gekappt } [Fact] public void Estimate_BeruecksichtigtNurBewerteteAspekte() { // "quantity" wurde nie bewertet - fließt nicht als 0 in den Mittelwert ein. var ratings = new List { new() { Key = "quality", Value = 2 } }; var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Quality, Quantity], null); Assert.Equal(2, estimate); } [Fact] public void Estimate_PunkteAspekt_WirdAufDieMinus2Bis2AchseNormiert() { // 4 von 4 Punkten -> oberes Ende der Achse (+2). var ratings = new List { new() { Key = "points", Value = 4 } }; var estimate = ParticipationCompetencyEstimate.Estimate(ratings, [Points], null); Assert.Equal(2, estimate); } }