自选实验项目教师代选
This commit is contained in:
1 parent
1c488d70e5
commit
68be9dfc3d
3 files changed
+224
No files matched your search
@@ -402,6 +402,31 @@ public sealed class ExperimentsControllerTests
|
||||
sessions[1].Id))!.ReservedCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ManagerCanProxyBookAStudentAfterTheSelectionWindowHasClosed()
|
||||
{
|
||||
await using var fixture = await ExperimentFixture.CreateAsync();
|
||||
var manager = fixture.Controller(fixture.ManagerScope);
|
||||
await manager.CreateProject(
|
||||
fixture.ProjectRequest(ExperimentArrangementMode.SelfScheduled),
|
||||
CancellationToken.None);
|
||||
var project = await fixture.Db.ExperimentProjects.SingleAsync();
|
||||
await manager.CreateSession(
|
||||
project.Id, fixture.SessionRequest(3, 2), CancellationToken.None);
|
||||
await manager.PublishProject(project.Id, CancellationToken.None);
|
||||
project.SelectionStartsAt = DateTime.UtcNow.AddDays(-2);
|
||||
project.SelectionEndsAt = DateTime.UtcNow.AddDays(-1);
|
||||
await fixture.Db.SaveChangesAsync();
|
||||
var session = await fixture.Db.ExperimentSessions.SingleAsync();
|
||||
var studentId = await fixture.Db.Students.Select(x => x.Id).SingleAsync();
|
||||
|
||||
Assert.IsType<NoContentResult>(await manager.CreateProxyBooking(
|
||||
session.Id, new ProxyExperimentBookingRequest(studentId), CancellationToken.None));
|
||||
Assert.Equal(1, await fixture.Db.ExperimentBookings.CountAsync(x =>
|
||||
x.ExperimentSessionId == session.Id && x.StudentId == studentId &&
|
||||
x.Status == ExperimentBookingStatus.Booked));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task StudentBooking_RejectsPublishedTimetableConflict()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user