# AB Legacy test fixture Coverage map + gap inventory for the AB Legacy (PCCC) driver — SLC 500 / MicroLogix / PLC-5 / LogixPccc-mode. **TL;DR: there is no integration fixture.** Everything runs through a `FakeAbLegacyTag` injected via `IAbLegacyTagFactory`. libplctag powers the real wire path but ships no in-process fake, and `ab_server` has no PCCC emulation either — so PCCC behavior against real hardware is trusted from field deployments, not from CI. ## What the fixture is Nothing at the integration layer. `tests/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.Tests/` is unit-only, all tests tagged `[Trait("Category", "Unit")]`. The driver accepts `IAbLegacyTagFactory` via ctor DI; every test supplies a `FakeAbLegacyTag`. ## What it actually covers (unit only) - `AbLegacyAddressTests` — PCCC address parsing for SLC / MicroLogix / PLC-5 / LogixPccc-mode (`N7:0`, `F8:12`, `B3:0/5`, etc.) - `AbLegacyCapabilityTests` — data type mapping, read-only enforcement - `AbLegacyReadWriteTests` — read + write happy + error paths against the fake - `AbLegacyBitRmwTests` — bit-within-DINT read-modify-write serialization via per-parent `SemaphoreSlim` (mirrors the AB CIP + FOCAS PMC-bit pattern from #181) - `AbLegacyHostAndStatusTests` — probe + host-status transitions driven by fake-returned statuses - `AbLegacyDriverTests` — `IDriver` lifecycle Capability surfaces whose contract is verified: `IDriver`, `IReadable`, `IWritable`, `ITagDiscovery`, `ISubscribable`, `IHostConnectivityProbe`, `IPerCallHostResolver`. ## What it does NOT cover ### 1. Wire-level PCCC No PCCC frame is sent by the test suite. libplctag's PCCC subset (DF1, ControlNet-over-EtherNet, PLC-5 native EtherNet) is untested here; driver-side correctness depends on libplctag being correct. ### 2. Family-specific behavior - SLC 500 timeout + retry thresholds (SLC's comm module has known slow-response edges) — unit fakes don't simulate timing. - MicroLogix 1100 / 1400 max-connection-count limits — not stressed. - PLC-5 native EtherNet connection setup (PCCC-encapsulated-in-CIP vs raw CSPv4) — routing covered at parse level only. ### 3. Multi-device routing `IPerCallHostResolver` contract is verified; real PCCC wire routing across multiple gateways is not. ### 4. Alarms / history PCCC has no alarm object + no history object. Driver doesn't implement `IAlarmSource` or `IHistoryProvider` — no test coverage is the correct shape. ### 5. File-type coverage PCCC has many file types (N, F, B, T, C, R, S, ST, A) — the parser tests cover the common ones but uncommon ones (`R` counters, `S` status files, `A` ASCII strings) have thin coverage. ## When to trust AB Legacy tests, when to reach for a rig | Question | Unit tests | Real PLC | | --- | --- | --- | | "Does `N7:0/5` parse correctly?" | yes | - | | "Does bit-in-word RMW serialize concurrent writers?" | yes | yes | | "Does the driver lifecycle hang / crash?" | yes | yes | | "Does a real read against an SLC 500 return correct bytes?" | no | yes (required) | | "Does MicroLogix 1100 respect its connection-count cap?" | no | yes (required) | | "Do PLC-5 ST-files round-trip correctly?" | no | yes (required) | ## Follow-up candidates 1. **Nothing open-source** — libplctag's test suite runs against real hardware; there is no public PCCC simulator comparable to `pymodbus` or `ab_server`. 2. **Lab rig** — cheapest path is a used SLC 5/05 or MicroLogix 1100 on a dedicated network; the parts are end-of-life but still available. PLC-5 and LogixPccc-mode behavior require those specific controllers. 3. **libplctag upstream test harness** — the project's own `tests/` folder has PCCC cases we could try to adapt, but they assume specific hardware. AB Legacy is inherently a trust-the-library driver until someone stands up a rig. ## Key fixture / config files - `tests/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.Tests/FakeAbLegacyTag.cs` — in-process fake + factory - `src/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy/AbLegacyDriver.cs` — scope remarks at the top of the file