开放实验项目发布后修正功能

This commit is contained in:
2026-08-10 17:02:39 +08:00 Unverified
parent fc326ac16e
commit 834574accb
3 changed files with 128 additions and 8 deletions
@@ -246,6 +246,35 @@ public sealed class ExperimentsControllerTests
Assert.Empty(await fixture.Db.ExperimentSessions.ToListAsync());
}
[Fact]
public async Task PublishedProject_AllowsTeachingDetailCorrectionWithoutChangingSchedule()
{
await using var fixture = await ExperimentFixture.CreateAsync();
var controller = fixture.Controller(fixture.ManagerScope);
await controller.CreateProject(
fixture.ProjectRequest(ExperimentArrangementMode.Centralized),
CancellationToken.None);
var project = await fixture.Db.ExperimentProjects.SingleAsync();
await controller.PublishProject(project.Id, CancellationToken.None);
fixture.Db.ChangeTracker.Clear();
Assert.IsType<NoContentResult>(await controller.CorrectPublishedProjectDetails(
project.Id,
new PublishedExperimentProjectCorrectionRequest(
"修正后的实验名称",
"按本班教学计划调整实验步骤。",
"请提前完成环境检查。"),
CancellationToken.None));
fixture.Db.ChangeTracker.Clear();
var corrected = await fixture.Db.ExperimentProjects.SingleAsync();
Assert.Equal("修正后的实验名称", corrected.Name);
Assert.Equal("按本班教学计划调整实验步骤。", corrected.Description);
Assert.Equal("请提前完成环境检查。", corrected.Requirements);
Assert.Equal("LAB-C", corrected.Code);
Assert.Equal(fixture.ScheduleEntry.Id, corrected.ScheduleEntryId);
}
[Fact]
public async Task SelfScheduledBooking_IsSinglePerProjectAndCanBeChanged()
{