Neue Klasse ParticipationRatingScale (Core) ist die einzige Quelle für Rohwerte je Aspekt-Typ. Scale3/Binary liegen bewusst direkt auf derselben -2..+2-Achse wie Scale5 (nur mit weniger Zwischenschritten), damit die bestehende Gewichtung/Mittelwertbildung zur Mitarbeitsnote unverändert kompatibel bleibt. Points ist grundverschieden (echter Zählwert 0..MaxPoints, neues Feld auf ParticipationAspect) und wird nur zur Aggregation linear auf dieselbe Achse normiert. Ohne diese Normierung hätte ein Punkte-Aspekt die Mitarbeitsnote verfälscht: drei Stellen summierten bisher den Rohwert direkt (ParticipationGradeDialog- ViewModel.Recompute, ParticipationWizardViewModels.WeightedRating und .ComputeSuggestion) - alle drei sind jetzt auf die Normierung umgestellt. Raster: Punkte-Aspekte zeigen ein NumericUpDown statt fester Stufen-Buttons. Schnelleingabe-Dialog: Zifferntasten/+/- sind jetzt typabhängig, Legende zeigt live die für den aktuellen Aspekt gültigen Tasten. Aspekt-Verwaltung um "Max. Punkte"-Feld ergänzt (nur bei Typ "Punkte" sichtbar). Bewusst nicht angefasst: die Trendlinien-Visualisierung im Mitarbeits-Assistenten bleibt fest auf die drei Standardaspekte zugeschnitten - eigener, größerer Umbau. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
81 lines
2.6 KiB
C#
81 lines
2.6 KiB
C#
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));
|
|
}
|
|
}
|