Give each school its own people seed so composition no longer follows create order.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 00:28:13 +03:00
co-authored by Cursor
parent 0c3eb219c8
commit 48f0b15221
17 changed files with 233 additions and 35 deletions
+13 -5
View File
@@ -371,9 +371,13 @@ public class SchoolApiTests(AppHostFixture fixture)
return state;
}
internal static async Task<SchoolResponse> CreateAsync(HttpClient client, string name, DateTime startDate)
internal static async Task<SchoolResponse> CreateAsync(
HttpClient client,
string name,
DateTime startDate,
int? seed = null)
{
using var response = await PostAsync(client, name, startDate);
using var response = await PostAsync(client, name, startDate, seed);
response.EnsureSuccessStatusCode();
var created = await response.Content.ReadFromJsonAsync<SchoolResponse>(TestContext.Current.CancellationToken);
@@ -406,10 +410,14 @@ public class SchoolApiTests(AppHostFixture fixture)
links = new[] { new { a = "yard", b = "office" } },
};
private static Task<HttpResponseMessage> PostAsync(HttpClient client, string name, DateTime startDate) =>
private static Task<HttpResponseMessage> PostAsync(
HttpClient client,
string name,
DateTime startDate,
int? seed = null) =>
client.PostAsJsonAsync(
"/api/schools",
new { name, startDate },
seed is null ? (object)new { name, startDate } : new { name, startDate, seed },
TestContext.Current.CancellationToken);
private static async Task<string?> ProblemCodeAsync(HttpResponseMessage response)
@@ -418,7 +426,7 @@ public class SchoolApiTests(AppHostFixture fixture)
return problem?.Code;
}
internal sealed record SchoolResponse(int Id, string Name, DateTime GameTime, bool Running, byte SpeedIndex);
internal sealed record SchoolResponse(int Id, string Name, DateTime GameTime, bool Running, byte SpeedIndex, int Seed);
internal sealed record SchoolsResponse(
int MaxSchools,