NEO-29: align hotbar persistence test to AAA style
Refactor the Postgres hotbar persistence integration test to explicit Arrange/Act/Assert structure so it matches the team testing style guide.pull/54/head
parent
d25d7d0211
commit
4dc9f76f79
|
|
@ -15,13 +15,9 @@ public sealed class HotbarLoadoutPersistenceIntegrationTests(PostgresIntegration
|
||||||
[RequirePostgresFact]
|
[RequirePostgresFact]
|
||||||
public async Task PostThenGetAcrossNewFactory_ShouldPersistHotbarBindings()
|
public async Task PostThenGetAcrossNewFactory_ShouldPersistHotbarBindings()
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
await ResetHotbarTableAsync();
|
await ResetHotbarTableAsync();
|
||||||
|
var update = new HotbarLoadoutUpdateRequest
|
||||||
using (var firstClient = Factory.CreateClient())
|
|
||||||
{
|
|
||||||
var post = await firstClient.PostAsJsonAsync(
|
|
||||||
"/game/players/dev-local-1/hotbar-loadout",
|
|
||||||
new HotbarLoadoutUpdateRequest
|
|
||||||
{
|
{
|
||||||
SchemaVersion = HotbarLoadoutUpdateRequest.CurrentSchemaVersion,
|
SchemaVersion = HotbarLoadoutUpdateRequest.CurrentSchemaVersion,
|
||||||
Slots =
|
Slots =
|
||||||
|
|
@ -37,14 +33,25 @@ public sealed class HotbarLoadoutPersistenceIntegrationTests(PostgresIntegration
|
||||||
AbilityId = PrototypeAbilityRegistry.PrototypeGuard,
|
AbilityId = PrototypeAbilityRegistry.PrototypeGuard,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
};
|
||||||
Assert.Equal(HttpStatusCode.OK, post.StatusCode);
|
HttpStatusCode postStatus;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
using (var firstClient = Factory.CreateClient())
|
||||||
|
{
|
||||||
|
var post = await firstClient.PostAsJsonAsync(
|
||||||
|
"/game/players/dev-local-1/hotbar-loadout",
|
||||||
|
update);
|
||||||
|
postStatus = post.StatusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
await using var secondFactory = new PostgresWebApplicationFactory();
|
await using var secondFactory = new PostgresWebApplicationFactory();
|
||||||
using var secondClient = secondFactory.CreateClient();
|
using var secondClient = secondFactory.CreateClient();
|
||||||
var loadout = await secondClient.GetFromJsonAsync<HotbarLoadoutResponse>(
|
var loadout = await secondClient.GetFromJsonAsync<HotbarLoadoutResponse>(
|
||||||
"/game/players/dev-local-1/hotbar-loadout");
|
"/game/players/dev-local-1/hotbar-loadout");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Equal(HttpStatusCode.OK, postStatus);
|
||||||
Assert.NotNull(loadout);
|
Assert.NotNull(loadout);
|
||||||
Assert.Equal(PrototypeAbilityRegistry.PrototypePulse, loadout!.Slots[1].AbilityId);
|
Assert.Equal(PrototypeAbilityRegistry.PrototypePulse, loadout!.Slots[1].AbilityId);
|
||||||
Assert.Equal(PrototypeAbilityRegistry.PrototypeGuard, loadout.Slots[4].AbilityId);
|
Assert.Equal(PrototypeAbilityRegistry.PrototypeGuard, loadout.Slots[4].AbilityId);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue