using LehrerApp.Core.Models; using LehrerApp.Desktop.ViewModels.Groups; using Xunit; namespace LehrerApp.Desktop.Tests; /// Tests für 3.1.3: RatingCell muss je AspectValueType unterschiedliche gültige Rohwerte und /// Schrittweiten für Hoch/Runter (Raster) durchsetzen, nicht mehr pauschal -2..+2 wie zuvor. public sealed class RatingCellTests { [Fact] public void CycleUp_Scale3_SpringtZwischenDenDreiStufen() { var cell = new RatingCell(Guid.NewGuid(), "k", null, AspectValueType.Scale3); cell.CycleUpCommand.Execute(null); Assert.Equal(-2, cell.Value); cell.CycleUpCommand.Execute(null); Assert.Equal(0, cell.Value); cell.CycleUpCommand.Execute(null); Assert.Equal(2, cell.Value); cell.CycleUpCommand.Execute(null); // bleibt am oberen Ende Assert.Equal(2, cell.Value); } [Fact] public void CycleUp_Binary_ToggeltNurZwischenDenBeidenExtremwerten() { var cell = new RatingCell(Guid.NewGuid(), "k", null, AspectValueType.Binary); cell.CycleUpCommand.Execute(null); Assert.Equal(-2, cell.Value); cell.CycleUpCommand.Execute(null); Assert.Equal(2, cell.Value); } [Fact] public void SetValue_Points_KapptAufMaxPoints() { var cell = new RatingCell(Guid.NewGuid(), "k", null, AspectValueType.Points, maxPoints: 4); cell.SetValue(99); Assert.Equal(4, cell.Value); } [Fact] public void CycleUp_Points_ZaehltEinzelnHochBisMaxPoints() { var cell = new RatingCell(Guid.NewGuid(), "k", 3, AspectValueType.Points, maxPoints: 4); cell.CycleUpCommand.Execute(null); Assert.Equal(4, cell.Value); cell.CycleUpCommand.Execute(null); // bleibt am Maximum Assert.Equal(4, cell.Value); } [Fact] public void CycleDown_Points_ZaehltEinzelnRunterBisNull() { var cell = new RatingCell(Guid.NewGuid(), "k", 1, AspectValueType.Points, maxPoints: 4); cell.CycleDownCommand.Execute(null); Assert.Equal(0, cell.Value); cell.CycleDownCommand.Execute(null); // bleibt bei 0 Assert.Equal(0, cell.Value); } [Fact] public void DisplayLabel_Scale5_UnveraendertGegenueberBisherigemVerhalten() { var cell = new RatingCell(Guid.NewGuid(), "k", 2); Assert.Equal("++", cell.DisplayLabel); } }