refactor: ScadaBridge module options registration -> AddValidatedOptions; clarify De Morgan predicates

This commit is contained in:
Joseph Doherty
2026-06-01 22:49:41 -04:00
parent 6dbbc7ad04
commit 9668a4e84a
3 changed files with 17 additions and 5 deletions
@@ -35,6 +35,12 @@ public sealed class HealthMonitoringOptionsValidator : OptionsValidatorBase<Heal
$"ScadaBridge:HealthMonitoring:CentralOfflineTimeout must be a positive duration " +
$"(was {options.CentralOfflineTimeout}).");
// Valid when CentralOfflineTimeout >= OfflineTimeout (both already
// required to be positive above). The De Morgan'd guard !(both positive
// AND Central < Offline) is true unless BOTH timeouts are positive and
// Central is strictly smaller — so it stays silent when either field is
// non-positive, leaving that failure to the dedicated positive-duration
// checks above rather than double-firing here.
builder.RequireThat(
!(options.OfflineTimeout > TimeSpan.Zero
&& options.CentralOfflineTimeout > TimeSpan.Zero