diff --git a/.cursor/rules/csharp-style.md b/.cursor/rules/csharp-style.md index 335739c..9a9c298 100644 --- a/.cursor/rules/csharp-style.md +++ b/.cursor/rules/csharp-style.md @@ -133,8 +133,9 @@ var store = secondScope.ServiceProvider.GetRequiredService(); // ## Documentation - Use **`///` XML doc comments** on public APIs (types and members) when behavior or contracts are not obvious. +- **Primary-constructor records:** include a **``** plus **``** for every constructor parameter (Roslynator RCS1139 / RCS1263). Do not leave orphaned `` lines without a summary on the type. -## Test project layout (`*.Tests`) +## Null checks (IDE0270) (`*.Tests`) - **Mirror the server project:** place test types under the same relative path as the production code they exercise (e.g. `NeonSprawl.Server/Game/PositionState/PositionStateApi.cs` → `NeonSprawl.Server.Tests/Game/PositionState/PositionStateApiTests.cs`). - Use a namespace that matches the folder tree under the test assembly root, e.g. `NeonSprawl.Server.Tests.Game.PositionState` for files in `Game/PositionState/`. diff --git a/server/NeonSprawl.Server.Tests/Game/PositionState/PostgresDockerHelper.cs b/server/NeonSprawl.Server.Tests/Game/PositionState/PostgresDockerHelper.cs index d4b9c3a..9ed5627 100644 --- a/server/NeonSprawl.Server.Tests/Game/PositionState/PostgresDockerHelper.cs +++ b/server/NeonSprawl.Server.Tests/Game/PositionState/PostgresDockerHelper.cs @@ -85,12 +85,9 @@ internal static class PostgresDockerHelper return; } - var root = FindDockerComposeRoot(); - if (root is null) - { - throw new InvalidOperationException( + var root = FindDockerComposeRoot() + ?? throw new InvalidOperationException( "Postgres is not reachable and docker-compose.yml was not found by walking up from the test output directory."); - } await RunDockerComposeAsync(root, "compose up -d", CancellationToken.None).ConfigureAwait(false); diff --git a/server/NeonSprawl.Server/Game/Gathering/ResourceNodeInstanceMutationOutcome.cs b/server/NeonSprawl.Server/Game/Gathering/ResourceNodeInstanceMutationOutcome.cs index 8c1f0bb..351025b 100644 --- a/server/NeonSprawl.Server/Game/Gathering/ResourceNodeInstanceMutationOutcome.cs +++ b/server/NeonSprawl.Server/Game/Gathering/ResourceNodeInstanceMutationOutcome.cs @@ -10,6 +10,8 @@ public enum ResourceNodeInstanceMutationKind Applied, } +/// Result of (NEO-61). +/// Applied or denied. /// Populated when is . /// Authoritative snapshot after apply, or current snapshot on depletion deny; null for unknown node. public readonly record struct ResourceNodeInstanceMutationOutcome( diff --git a/server/NeonSprawl.Server/Game/Items/PlayerInventoryMutationOutcome.cs b/server/NeonSprawl.Server/Game/Items/PlayerInventoryMutationOutcome.cs index edec38b..645bdc2 100644 --- a/server/NeonSprawl.Server/Game/Items/PlayerInventoryMutationOutcome.cs +++ b/server/NeonSprawl.Server/Game/Items/PlayerInventoryMutationOutcome.cs @@ -13,6 +13,8 @@ public enum PlayerInventoryMutationKind Applied, } +/// Result of or (NEO-54). +/// Applied, denied, or store missing. /// Populated when is . /// Authoritative snapshot after apply, or unchanged snapshot on deny; null when store missing. public readonly record struct PlayerInventoryMutationOutcome(