This commit is contained in:
1 parent
960d52686a
commit
1291b24478
11 files changed
+156
-15
No files matched your search
@@ -89,6 +89,31 @@ public sealed class DashboardViewModelTests
|
||||
private static DateOnly MissingTimeDate(AttentionItem item) =>
|
||||
((MissingTeachingTimeItem)item.Actions.Single().Parameter!).Date;
|
||||
|
||||
[Fact]
|
||||
public void OpenExcuses_ZeigtNurSchuelerAusEigenerKlasse()
|
||||
{
|
||||
var today = DateOnly.FromDateTime(DateTime.Today);
|
||||
var ownClass = new LearningGroup { Name = "Meine 9c", IsOwnClass = true };
|
||||
var otherClass = new LearningGroup { Name = "Fremde 8a", IsOwnClass = false };
|
||||
var ownStudent = new Student { FirstName = "Anna", LastName = "Eigen" };
|
||||
var otherStudent = new Student { FirstName = "Ben", LastName = "Fremd" };
|
||||
var ownSession = new ParticipationSession { GroupId = ownClass.Id, Date = today.AddDays(-1) };
|
||||
var otherSession = new ParticipationSession { GroupId = otherClass.Id, Date = today.AddDays(-1) };
|
||||
var entries = new FakeEntries();
|
||||
entries.Add(new ParticipationEntry
|
||||
{ SessionId = ownSession.Id, StudentId = ownStudent.Id, Attendance = AttendanceStatus.ExcusePending });
|
||||
entries.Add(new ParticipationEntry
|
||||
{ SessionId = otherSession.Id, StudentId = otherStudent.Id, Attendance = AttendanceStatus.ExcusePending });
|
||||
|
||||
var vm = BuildVm(ownClass, new Lesson { GroupId = ownClass.Id, Date = today },
|
||||
allGroups: [ownClass, otherClass], students: new FakeStudents([ownStudent, otherStudent]),
|
||||
sessions: new FakeSessions([ownSession, otherSession]), entries: entries);
|
||||
|
||||
var excuse = Assert.Single(Items(vm, AttentionKind.Excuse));
|
||||
Assert.Equal(ownStudent.FullName, excuse.Title);
|
||||
Assert.DoesNotContain(Items(vm, AttentionKind.Excuse), item => item.Title == otherStudent.FullName);
|
||||
}
|
||||
|
||||
private static PeriodScheduleService NewPeriodSchedule()
|
||||
{
|
||||
var tempPath = System.IO.Path.Combine(
|
||||
@@ -780,6 +805,8 @@ public sealed class DashboardViewModelTests
|
||||
var item = Assert.Single(Items(vm, AttentionKind.Attendance));
|
||||
Assert.Equal(student.FullName, item.Title);
|
||||
Assert.Equal("30 %", item.TrailingText);
|
||||
Assert.True(item.IsAttendanceWarning);
|
||||
Assert.Equal(AttentionKind.Attendance, vm.Attention.First().Kind);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in new issue
Block a user