Fix test harness casing and exclude test sources from app

This commit is contained in:
2026-02-05 17:51:36 +01:00
parent 7e2d9ba9b8
commit f2f1784ae8
7 changed files with 14 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ public class AuthTests
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadFromJsonAsync<JsonElement>();
Assert.True(json.GetProperty("IsAdmin").GetBoolean());
Assert.True(json.GetProperty("isAdmin").GetBoolean());
}
[Fact]

View File

@@ -29,7 +29,7 @@ public class ResultsTests
Assert.True(results.GetArrayLength() >= 1);
var first = results[0];
Assert.Equal("ResultGame", first.GetProperty("Name").GetString());
Assert.Equal(8, (int)first.GetProperty("Average").GetDouble());
Assert.Equal("ResultGame", first.GetProperty("name").GetString());
Assert.Equal(8, (int)first.GetProperty("average").GetDouble());
}
}

View File

@@ -39,7 +39,7 @@ public class StateTests
var state = await player.GetFromJsonAsync<JsonElement>("/api/state");
Assert.Equal((int)Phase.Results, state.GetProperty("CurrentPhase").GetInt32());
Assert.Equal(Phase.Results.ToString(), state.GetProperty("currentPhase").GetString());
Assert.True(state.GetProperty("resultsOpen").GetBoolean());
}
}

View File

@@ -13,6 +13,6 @@ internal class StubHttpClientFactory : IHttpClientFactory
public HttpClient CreateClient(string name)
{
return new HttpClient(_handler, dispose: false);
return new HttpClient(_handler, disposeHandler: false);
}
}

View File

@@ -41,6 +41,6 @@ internal static class TestClientExtensions
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadFromJsonAsync<JsonElement>();
return json.GetProperty("Id").GetInt32();
return json.GetProperty("id").GetInt32();
}
}

View File

@@ -52,8 +52,9 @@ public class VoteTests
vote.EnsureSuccessStatusCode();
var mine = await player.GetFromJsonAsync<List<VoteRecord>>("/api/votes/mine");
Assert.NotNull(mine);
Assert.Equal(2, mine.Count);
Assert.Equal(2, mine!.Count);
Assert.All(mine, v => Assert.Equal(9, v.Score));
}

View File

@@ -14,4 +14,10 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.2" />
</ItemGroup>
<ItemGroup>
<Compile Remove="GameList.Tests\**\*.cs" />
<EmbeddedResource Remove="GameList.Tests\**\*" />
<None Remove="GameList.Tests\**\*" />
</ItemGroup>
</Project>