Fix test harness casing and exclude test sources from app
This commit is contained in:
@@ -18,7 +18,7 @@ public class AuthTests
|
|||||||
|
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
var json = await response.Content.ReadFromJsonAsync<JsonElement>();
|
var json = await response.Content.ReadFromJsonAsync<JsonElement>();
|
||||||
Assert.True(json.GetProperty("IsAdmin").GetBoolean());
|
Assert.True(json.GetProperty("isAdmin").GetBoolean());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class ResultsTests
|
|||||||
|
|
||||||
Assert.True(results.GetArrayLength() >= 1);
|
Assert.True(results.GetArrayLength() >= 1);
|
||||||
var first = results[0];
|
var first = results[0];
|
||||||
Assert.Equal("ResultGame", first.GetProperty("Name").GetString());
|
Assert.Equal("ResultGame", first.GetProperty("name").GetString());
|
||||||
Assert.Equal(8, (int)first.GetProperty("Average").GetDouble());
|
Assert.Equal(8, (int)first.GetProperty("average").GetDouble());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class StateTests
|
|||||||
|
|
||||||
var state = await player.GetFromJsonAsync<JsonElement>("/api/state");
|
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());
|
Assert.True(state.GetProperty("resultsOpen").GetBoolean());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ internal class StubHttpClientFactory : IHttpClientFactory
|
|||||||
|
|
||||||
public HttpClient CreateClient(string name)
|
public HttpClient CreateClient(string name)
|
||||||
{
|
{
|
||||||
return new HttpClient(_handler, dispose: false);
|
return new HttpClient(_handler, disposeHandler: false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,6 @@ internal static class TestClientExtensions
|
|||||||
|
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
var json = await response.Content.ReadFromJsonAsync<JsonElement>();
|
var json = await response.Content.ReadFromJsonAsync<JsonElement>();
|
||||||
return json.GetProperty("Id").GetInt32();
|
return json.GetProperty("id").GetInt32();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,8 +52,9 @@ public class VoteTests
|
|||||||
vote.EnsureSuccessStatusCode();
|
vote.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
var mine = await player.GetFromJsonAsync<List<VoteRecord>>("/api/votes/mine");
|
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));
|
Assert.All(mine, v => Assert.Equal(9, v.Score));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,4 +14,10 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.2" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="GameList.Tests\**\*.cs" />
|
||||||
|
<EmbeddedResource Remove="GameList.Tests\**\*" />
|
||||||
|
<None Remove="GameList.Tests\**\*" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user