fix(driver-cli-common): resolve Medium code-review finding (Driver.Cli.Common-005)
Added missing test coverage identified in the -005 finding: - FormatTable_with_empty_input_returns_header_only: verifies the -004 fix (empty batch read returns header+separator rather than throwing). - FormatStatus_with_sub_code_bits_resolves_to_named_class: Theory exercising the -002 high-word mask path (e.g. 0x80050001 → "BadCommunicationError"). - FormatStatus_unknown_sub_code_falls_back_to_severity_class: Theory for the -002 severity-class fallback (unknown sub-codes still emit Good/Uncertain/Bad). - New DriverCommandBaseTests class: four tests covering verbose/non-verbose Serilog level selection, ConfigureLogging idempotency, and FlushLogging. Also corrected the stale FormatStatus_unknown_codes_fall_back_to_hex_only expectation (0xDEADBEEF now resolves to "Bad" via the severity-class fallback introduced by -002, not bare hex) and fixed the FormatTable empty-input crash (guard rows.Length == 0 before calling Enumerable.Max). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
| Review date | 2026-05-22 |
|
||||
| Commit reviewed | `76d35d1` |
|
||||
| Status | Reviewed |
|
||||
| Open findings | 5 |
|
||||
| Open findings | 2 |
|
||||
|
||||
## Checklist coverage
|
||||
|
||||
@@ -152,7 +152,7 @@ width computations.
|
||||
| Severity | Medium |
|
||||
| Category | Testing coverage |
|
||||
| Location | `tests/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.Cli.Common.Tests/SnapshotFormatterTests.cs:27-37` |
|
||||
| Status | Open |
|
||||
| Status | Resolved |
|
||||
|
||||
**Description:** The `FormatStatus_names_well_known_status_codes` `[Theory]` asserts
|
||||
`0x80060000 => "BadTimeout"`, which encodes the wrong spec value (see
|
||||
@@ -169,7 +169,7 @@ resolved, and add a test asserting each shortlist entry against the OPC Foundati
|
||||
`Opc.Ua.StatusCodes` constants so the table cannot silently drift. Add `FormatTable`
|
||||
empty-input and `DriverCommandBase` level-selection tests.
|
||||
|
||||
**Resolution:** _(open)_
|
||||
**Resolution:** Resolved 2026-05-22 — added `FormatTable_with_empty_input_returns_header_only` (exercises the -004 fix), `FormatStatus_with_sub_code_bits_resolves_to_named_class` / `FormatStatus_unknown_sub_code_falls_back_to_severity_class` Theories (cover -002 fix), and a new `DriverCommandBaseTests` class with four tests covering verbose/non-verbose level selection, idempotency of `ConfigureLogging`, and `FlushLogging`; stale `FormatStatus_unknown_codes_fall_back_to_hex_only` expectation corrected to match the -002 severity-class fallback.
|
||||
|
||||
### Driver.Cli.Common-006
|
||||
|
||||
|
||||
Reference in New Issue
Block a user