NEO-146: restore test layout section in csharp-style guide
Fix IDE0270 section that accidentally overwrote the test project layout heading.pull/187/head
parent
b519f4e9eb
commit
a4f37db594
|
|
@ -135,7 +135,16 @@ var store = secondScope.ServiceProvider.GetRequiredService<IExampleStore>(); //
|
|||
- 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.
|
||||
|
||||
## Null checks (IDE0270) (`*.Tests`)
|
||||
## Null checks (IDE0270)
|
||||
|
||||
- Prefer **`?? throw`** over `if (x is null) { throw … }` when assigning a non-null local from a nullable expression.
|
||||
|
||||
```csharp
|
||||
var root = FindDockerComposeRoot()
|
||||
?? throw new InvalidOperationException("…");
|
||||
```
|
||||
|
||||
## Test project layout (`*.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/`.
|
||||
|
|
|
|||
Loading…
Reference in New Issue