Merge branch 'phase/37-school-rules'
This commit is contained in:
@@ -54,6 +54,38 @@ public class DressRulesApiTests(AppHostFixture fixture)
|
||||
Assert.Equal(before.Worn.Select(row => row.DefName), after.Worn.Select(row => row.DefName));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task UnknownForm_Returns400()
|
||||
{
|
||||
using var client = fixture.App.CreateHttpClient("server");
|
||||
await SchoolApiTests.ResetAsync(client);
|
||||
var school = await SchoolApiTests.CreateAsync(client, "Плохая форма", Start, seed: 35);
|
||||
|
||||
using var response = await client.PostAsJsonAsync(
|
||||
$"/api/schools/{school.Id}/dress-rules",
|
||||
new { students = new { form = "tuxedo", color = "noBright" } },
|
||||
TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
||||
Assert.Equal("unknown-form", await SchoolApiTests.ProblemCodeAsync(response));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task UnknownColor_Returns400()
|
||||
{
|
||||
using var client = fixture.App.CreateHttpClient("server");
|
||||
await SchoolApiTests.ResetAsync(client);
|
||||
var school = await SchoolApiTests.CreateAsync(client, "Плохой цвет", Start, seed: 35);
|
||||
|
||||
using var response = await client.PostAsJsonAsync(
|
||||
$"/api/schools/{school.Id}/dress-rules",
|
||||
new { students = new { form = "regular", color = "neon" } },
|
||||
TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
||||
Assert.Equal("unknown-color", await SchoolApiTests.ProblemCodeAsync(response));
|
||||
}
|
||||
|
||||
private sealed record DressRulesDto(DressRulePairDto Students, DressRulePairDto Staff);
|
||||
|
||||
private sealed record DressRulePairDto(string Form, string Color);
|
||||
|
||||
Reference in New Issue
Block a user