test(drivers): tighten driver-page converter guard + clarify S7 numeric case

Code-review follow-ups: the page-coverage test now asserts every *DriverPage
declares a _jsonOpts serializer (so a new page that serialises config a
different way fails the guard, not just converter removal); clarify that 40 ==
(int)S7CpuType.S71500 in the numeric-throws test.
This commit is contained in:
Joseph Doherty
2026-06-19 05:06:43 -04:00
parent 4b14feb373
commit a0dccbf8ee
2 changed files with 14 additions and 4 deletions
@@ -40,6 +40,8 @@ public sealed class S7DriverConfigEnumSerializationTests
[Fact]
public void Factory_throws_on_the_numeric_enum_form_the_pre_fix_page_emitted()
{
// 40 == (int)S7CpuType.S71500 — exactly what the pre-fix page (no converter) wrote for S71500.
// The throw comes from binding a JSON number to the DTO's string? CpuType, so it fires for any number.
const string numericBlob = "{\"host\":\"10.0.0.5\",\"port\":102,\"cpuType\":40,\"rack\":0,\"slot\":1}";
Should.Throw<Exception>(() => S7DriverFactoryExtensions.ParseOptions("s7-test", numericBlob));
}