NEO-146: fix mutation outcome docs and null-check style
Add summary and Kind param XML docs on mutation outcome records, simplify PostgresDockerHelper null guard with ?? throw, and document RCS1139/IDE0270.pull/187/head
parent
b6b0b87534
commit
b519f4e9eb
|
|
@ -133,8 +133,9 @@ var store = secondScope.ServiceProvider.GetRequiredService<IExampleStore>(); //
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
- Use **`///` XML doc comments** on public APIs (types and members) when behavior or contracts are not obvious.
|
- Use **`///` XML doc comments** on public APIs (types and members) when behavior or contracts are not obvious.
|
||||||
|
- **Primary-constructor records:** include a **`<summary>`** plus **`<param>`** for every constructor parameter (Roslynator RCS1139 / RCS1263). Do not leave orphaned `<param>` 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`).
|
- **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/`.
|
- 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/`.
|
||||||
|
|
|
||||||
|
|
@ -85,12 +85,9 @@ internal static class PostgresDockerHelper
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var root = FindDockerComposeRoot();
|
var root = FindDockerComposeRoot()
|
||||||
if (root is null)
|
?? throw new InvalidOperationException(
|
||||||
{
|
|
||||||
throw new InvalidOperationException(
|
|
||||||
"Postgres is not reachable and docker-compose.yml was not found by walking up from the test output directory.");
|
"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);
|
await RunDockerComposeAsync(root, "compose up -d", CancellationToken.None).ConfigureAwait(false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ public enum ResourceNodeInstanceMutationKind
|
||||||
Applied,
|
Applied,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Result of <see cref="ResourceNodeInstanceOperations.TryCommitSuccessfulGatherDecrement"/> (NEO-61).</summary>
|
||||||
|
/// <param name="Kind">Applied or denied.</param>
|
||||||
/// <param name="ReasonCode">Populated when <see cref="Kind"/> is <see cref="ResourceNodeInstanceMutationKind.Denied"/>.</param>
|
/// <param name="ReasonCode">Populated when <see cref="Kind"/> is <see cref="ResourceNodeInstanceMutationKind.Denied"/>.</param>
|
||||||
/// <param name="Snapshot">Authoritative snapshot after apply, or current snapshot on depletion deny; null for unknown node.</param>
|
/// <param name="Snapshot">Authoritative snapshot after apply, or current snapshot on depletion deny; null for unknown node.</param>
|
||||||
public readonly record struct ResourceNodeInstanceMutationOutcome(
|
public readonly record struct ResourceNodeInstanceMutationOutcome(
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ public enum PlayerInventoryMutationKind
|
||||||
Applied,
|
Applied,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Result of <see cref="PlayerInventoryOperations.TryAddStack"/> or <see cref="PlayerInventoryOperations.TryRemoveStack"/> (NEO-54).</summary>
|
||||||
|
/// <param name="Kind">Applied, denied, or store missing.</param>
|
||||||
/// <param name="ReasonCode">Populated when <see cref="Kind"/> is <see cref="PlayerInventoryMutationKind.Denied"/>.</param>
|
/// <param name="ReasonCode">Populated when <see cref="Kind"/> is <see cref="PlayerInventoryMutationKind.Denied"/>.</param>
|
||||||
/// <param name="Snapshot">Authoritative snapshot after apply, or unchanged snapshot on deny; null when store missing.</param>
|
/// <param name="Snapshot">Authoritative snapshot after apply, or unchanged snapshot on deny; null when store missing.</param>
|
||||||
public readonly record struct PlayerInventoryMutationOutcome(
|
public readonly record struct PlayerInventoryMutationOutcome(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue