feat: add seating plan drag and quick assessment
This commit is contained in:
@@ -299,6 +299,38 @@ public sealed class RepositoryTests
|
||||
Assert.Throws<InvalidOperationException>(() => new SeatingPlanRepository(db).Save(plan));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SeatingPlanRepository_AktualisiertPlanMitFehlendemOptionalenRaum()
|
||||
{
|
||||
using var db = NewInMemoryContext();
|
||||
var group = new LearningGroup { Name = "8a", SchoolYear = "2025/26" };
|
||||
new GroupRepository(db).Save(group);
|
||||
var student = new Student { FirstName = "Anna", LastName = "A" };
|
||||
db.Students.Insert(student);
|
||||
db.Memberships.Insert(new GroupMembership { GroupId = group.Id, StudentId = student.Id });
|
||||
var plan = new SeatingPlan
|
||||
{
|
||||
GroupId = group.Id,
|
||||
Name = "Standard",
|
||||
Room = null!,
|
||||
Rows = 2,
|
||||
Columns = 2,
|
||||
};
|
||||
db.SeatingPlans.Insert(plan);
|
||||
plan.Assignments.Add(new SeatAssignment { Row = 0, Column = 0, StudentId = student.Id });
|
||||
|
||||
new SeatingPlanRepository(db).Save(plan);
|
||||
|
||||
var saved = db.SeatingPlans.FindById(plan.Id);
|
||||
Assert.NotNull(saved);
|
||||
Assert.True(string.IsNullOrEmpty(saved.Room));
|
||||
Assert.Equal(student.Id, saved.Assignments.Single().StudentId);
|
||||
|
||||
// LiteDB may materialize the empty optional value as null again. A later
|
||||
// drag/drop save must therefore remain safe as well.
|
||||
new SeatingPlanRepository(db).Save(saved);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GroupMembershipRepository_Save_LehntZweiteZuordnungFuerGleichesPaarAb()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user