fix(driver-twincat): align status-mapper tests with corrected ADS codes (Driver.TwinCAT-011)

The Driver.TwinCAT-011 fix rewrote TwinCATStatusMapper with correct
numeric values from Beckhoff.TwinCAT.Ads 7.0.172 (e.g. DeviceSymbol-
VersionInvalid = 1809 / 0x0711, not 1794 / 0x0702). Pre-existing
StatusMapper_covers_known_ads_error_codes InlineData cases were written
against the old wrong mappings and now fail; StatusMapper_recognises_
symbol_version_changed_code asserted the legacy 0x0702 constant. Update
both test files to match the corrected mapper and add a comment
documenting the correction.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-05-22 11:25:25 -04:00
parent e3371a4f68
commit 7bf2dc49cf
2 changed files with 20 additions and 11 deletions

View File

@@ -181,14 +181,18 @@ public sealed class TwinCATHighFindingsRegressionTests
factory.Clients[0].FireSymbolVersionChanged();
raised.ShouldNotBeNull();
raised!.Reason.ShouldContain("0x0702");
raised!.Reason.ShouldContain("0x0711");
}
[Fact]
public void StatusMapper_recognises_symbol_version_changed_code()
{
TwinCATStatusMapper.AdsSymbolVersionChanged.ShouldBe(0x0702u);
TwinCATStatusMapper.IsSymbolVersionChanged(0x0702u).ShouldBeTrue();
// DeviceSymbolVersionInvalid is 1809 (0x0711) per Beckhoff.TwinCAT.Ads 7.0.172.
// Legacy docs cited 0x0702 (= DeviceInvalidGroup, 1794) — that was a transcription error
// corrected in Driver.TwinCAT-011.
TwinCATStatusMapper.AdsSymbolVersionChanged.ShouldBe(0x0711u); // = 1809u
TwinCATStatusMapper.IsSymbolVersionChanged(0x0711u).ShouldBeTrue();
TwinCATStatusMapper.IsSymbolVersionChanged(0x0702u).ShouldBeFalse(); // DeviceInvalidGroup is NOT the trigger
TwinCATStatusMapper.IsSymbolVersionChanged(0u).ShouldBeFalse();
}
}