Files
LehrerApp/LehrerApp.Desktop.Tests/ExamVariantScoringTests.cs
T

35 lines
1.1 KiB
C#

using LehrerApp.Core.Models;
using LehrerApp.Core.Services;
using LehrerApp.Desktop.ViewModels.Groups;
using Xunit;
namespace LehrerApp.Desktop.Tests;
public class ExamVariantScoringTests
{
[Fact]
public void Fassungswechsel_BerechnetPunkteUndNoteNeu()
{
var tasks = new List<ExamTask>
{
new() { Nr = 1, MaxPoints = 10 },
new() { Nr = 2, MaxPoints = 5, Variant = ExamVariant.A },
new() { Nr = 3, MaxPoints = 8, Variant = ExamVariant.B },
new() { Nr = 4, MaxPoints = 2, IsBonus = true },
};
var existing = new ExamResult { Points = [8, 5, 8, 2] };
var row = new ExamResultRow(Guid.NewGuid(), "Test", tasks, existing,
GradingService.DefaultKey1To6(), 15, new GradingService());
Assert.Equal(15, row.TotalPoints);
Assert.False(row.Cells[2].IsApplicable);
row.VariantName = "B";
Assert.Equal(18, row.TotalPoints);
Assert.False(row.Cells[1].IsApplicable);
Assert.True(row.Cells[2].IsApplicable);
Assert.Equal(ExamVariant.B, row.ToModel(Guid.NewGuid()).Variant);
}
}