C# formatting
This commit is contained in:
@@ -9,7 +9,7 @@ public class ResultsTests
|
||||
[Fact]
|
||||
public async Task Results_available_after_admin_unlocks()
|
||||
{
|
||||
using var factory = new TestWebApplicationFactory();
|
||||
await using var factory = new TestWebApplicationFactory();
|
||||
var admin = factory.CreateClientWithCookies();
|
||||
await admin.RegisterAsync("admin", admin: true);
|
||||
|
||||
@@ -18,7 +18,11 @@ public class ResultsTests
|
||||
var suggestionId = await player.CreateSuggestionAsync("ResultGame");
|
||||
|
||||
await player.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await player.PostAsJsonAsync("/api/votes", new { SuggestionId = suggestionId, Score = 8 });
|
||||
await player.PostAsJsonAsync("/api/votes", new
|
||||
{
|
||||
SuggestionId = suggestionId,
|
||||
Score = 8
|
||||
});
|
||||
await player.PostAsJsonAsync("/api/votes/finalize", new { Final = true });
|
||||
|
||||
await admin.PostAsJsonAsync("/api/admin/results", new { resultsOpen = true });
|
||||
@@ -36,7 +40,7 @@ public class ResultsTests
|
||||
[Fact]
|
||||
public async Task Results_locked_returns_error()
|
||||
{
|
||||
using var factory = new TestWebApplicationFactory();
|
||||
await using var factory = new TestWebApplicationFactory();
|
||||
var client = factory.CreateClientWithCookies();
|
||||
await client.RegisterAsync("user");
|
||||
await client.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
@@ -47,7 +51,7 @@ public class ResultsTests
|
||||
[Fact]
|
||||
public async Task Results_require_results_phase_and_auth()
|
||||
{
|
||||
using var factory = new TestWebApplicationFactory();
|
||||
await using var factory = new TestWebApplicationFactory();
|
||||
var admin = factory.CreateClientWithCookies();
|
||||
await admin.RegisterAsync("admin", admin: true);
|
||||
var player = factory.CreateClientWithCookies();
|
||||
@@ -65,17 +69,21 @@ public class ResultsTests
|
||||
[Fact]
|
||||
public async Task Results_payload_contains_fields_and_ordering()
|
||||
{
|
||||
using var factory = new TestWebApplicationFactory();
|
||||
await using var factory = new TestWebApplicationFactory();
|
||||
var admin = factory.CreateClientWithCookies();
|
||||
await admin.RegisterAsync("admin", admin: true);
|
||||
|
||||
var player = factory.CreateClientWithCookies();
|
||||
await player.RegisterAsync("player");
|
||||
var s1 = await player.CreateSuggestionAsync("High");
|
||||
var s2 = await player.CreateSuggestionAsync("NoVotes");
|
||||
_ = await player.CreateSuggestionAsync("NoVotes");
|
||||
|
||||
await player.PostAsJsonAsync("/api/me/phase/next", new { });
|
||||
await player.PostAsJsonAsync("/api/votes", new { SuggestionId = s1, Score = 9 });
|
||||
await player.PostAsJsonAsync("/api/votes", new
|
||||
{
|
||||
SuggestionId = s1,
|
||||
Score = 9
|
||||
});
|
||||
await player.PostAsJsonAsync("/api/votes/finalize", new { Final = true });
|
||||
|
||||
await admin.PostAsJsonAsync("/api/admin/results", new { resultsOpen = true });
|
||||
@@ -83,7 +91,7 @@ public class ResultsTests
|
||||
|
||||
var results = await player.GetFromJsonAsync<List<JsonElement>>("/api/results");
|
||||
Assert.NotNull(results);
|
||||
Assert.Equal(2, results!.Count);
|
||||
Assert.Equal(2, results.Count);
|
||||
Assert.Equal("High", results[0].GetProperty("name").GetString());
|
||||
Assert.Equal(9, (int)results[0].GetProperty("average").GetDouble());
|
||||
Assert.Equal(1, results[0].GetProperty("count").GetInt32());
|
||||
|
||||
Reference in New Issue
Block a user