53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http.Json;
|
|
using NeonSprawl.Server.Game.Skills;
|
|
using Xunit;
|
|
|
|
namespace NeonSprawl.Server.Tests.Game.Skills;
|
|
|
|
public sealed class SkillProgressionSnapshotApiTests
|
|
{
|
|
[Fact]
|
|
public async Task GetSkillProgression_ShouldReturnNotFound_WhenPlayerUnknown()
|
|
{
|
|
// Arrange
|
|
await using var factory = new InMemoryWebApplicationFactory();
|
|
var client = factory.CreateClient();
|
|
|
|
// Act
|
|
var response = await client.GetAsync("/game/players/missing-player/skill-progression");
|
|
|
|
// Assert
|
|
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task GetSkillProgression_ShouldReturnSchemaV1_WithDefaultXpAndLevel_ForFrozenTrioInIdOrder()
|
|
{
|
|
// Arrange
|
|
await using var factory = new InMemoryWebApplicationFactory();
|
|
var client = factory.CreateClient();
|
|
|
|
// Act
|
|
var response = await client.GetAsync("/game/players/dev-local-1/skill-progression");
|
|
|
|
// Assert
|
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
var body = await response.Content.ReadFromJsonAsync<SkillProgressionSnapshotResponse>();
|
|
Assert.NotNull(body);
|
|
Assert.Equal(SkillProgressionSnapshotResponse.CurrentSchemaVersion, body!.SchemaVersion);
|
|
Assert.Equal("dev-local-1", body.PlayerId);
|
|
Assert.NotNull(body.Skills);
|
|
var ids = body.Skills.Select(static s => s.Id).ToList();
|
|
Assert.Equal(new[] { "intrusion", "refine", "salvage" }, ids);
|
|
Assert.All(
|
|
body.Skills,
|
|
s =>
|
|
{
|
|
Assert.Equal(0, s.Xp);
|
|
Assert.Equal(1, s.Level);
|
|
});
|
|
}
|
|
}
|