diff --git a/SVSim.UnitTests/Controllers/ReplayControllerTests.cs b/SVSim.UnitTests/Controllers/ReplayControllerTests.cs index 5ede95e..da63f6f 100644 --- a/SVSim.UnitTests/Controllers/ReplayControllerTests.cs +++ b/SVSim.UnitTests/Controllers/ReplayControllerTests.cs @@ -11,6 +11,18 @@ namespace SVSim.UnitTests.Controllers; public class ReplayControllerTests { + // Minimal BaseRequest-shaped body. The translation middleware (in prod) and the + // [FromBody] BaseRequest _ binding (in tests) both require the auth fields to + // be present even when their values are unused — same pattern as + // RankBattleControllerTests.FinishBody. The actual viewer_id comes from the + // session claim, not the body. + private static object EmptyBody() => new + { + viewer_id = "0", + steam_id = 0, + steam_session_ticket = "", + }; + [Test] public async Task ReplayInfo_returns_empty_list_for_fresh_viewer() { @@ -18,7 +30,7 @@ public class ReplayControllerTests long viewerId = await factory.SeedViewerAsync(steamId: 76_561_198_000_000_001UL); var client = factory.CreateAuthenticatedClient(viewerId); - var resp = await client.PostAsJsonAsync("/replay/info", new { }); + var resp = await client.PostAsJsonAsync("/replay/info", EmptyBody()); Assert.That(resp.StatusCode, Is.EqualTo(HttpStatusCode.OK)); var body = await resp.Content.ReadFromJsonAsync(); @@ -42,7 +54,7 @@ public class ReplayControllerTests } var client = factory.CreateAuthenticatedClient(viewerId); - var body = await client.PostAsJsonAsync("/replay/info", new { }) + var body = await client.PostAsJsonAsync("/replay/info", EmptyBody()) .ContinueWith(t => t.Result.Content.ReadFromJsonAsync()) .Unwrap(); @@ -66,7 +78,7 @@ public class ReplayControllerTests } var client = factory.CreateAuthenticatedClient(viewerA); - var body = await client.PostAsJsonAsync("/replay/info", new { }) + var body = await client.PostAsJsonAsync("/replay/info", EmptyBody()) .ContinueWith(t => t.Result.Content.ReadFromJsonAsync()) .Unwrap();