merge: MQTT browser+contracts review findings resolved (Driver.Mqtt.Browser-002..-005, Driver.Mqtt.Contracts-004..-007)
This commit is contained in:
@@ -260,6 +260,37 @@ public sealed class TagConfigNonEnumParityTests
|
||||
TagConfigValidator.Validate(DriverTypeNames.Mqtt, blob).ShouldBeNull();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MQTT's <c>retainSeed</c>, held to the same rule as <c>qos</c>: a JSON boolean or absent, and
|
||||
/// nothing else. The stringly-typed form is what a CSV import produces, and a lenient read turned
|
||||
/// it into the default <c>true</c> — the INVERSE of the authored intent. The model reads the key
|
||||
/// leniently into its own nullable field, so this parity holds only because
|
||||
/// <c>TagConfigParseGate</c> asks the driver's own reader rather than the model's typed fields.
|
||||
/// </summary>
|
||||
/// <param name="blob">A blob whose only fault is <c>retainSeed</c>.</param>
|
||||
[Theory]
|
||||
[InlineData("""{"topic":"otopcua/fixture/a","retainSeed":"false"}""")]
|
||||
[InlineData("""{"topic":"otopcua/fixture/a","retainSeed":0}""")]
|
||||
[InlineData("""{"topic":"otopcua/fixture/a","retainSeed":null}""")]
|
||||
[InlineData("""{"groupId":"OtOpcUaSim","edgeNodeId":"EdgeA","metricName":"M","retainSeed":"false"}""")]
|
||||
public void Mqtt_refuses_a_retainSeed_its_reader_refuses(string blob)
|
||||
{
|
||||
RuntimeAccepts(DriverTypeNames.Mqtt, blob).ShouldBeFalse();
|
||||
TagConfigValidator.Validate(DriverTypeNames.Mqtt, blob).ShouldNotBeNullOrEmpty();
|
||||
}
|
||||
|
||||
/// <summary>The paired acceptances: both real booleans, and an absent key.</summary>
|
||||
/// <param name="blob">A blob whose <c>retainSeed</c> is well-formed or absent.</param>
|
||||
[Theory]
|
||||
[InlineData("""{"topic":"otopcua/fixture/a","retainSeed":true}""")]
|
||||
[InlineData("""{"topic":"otopcua/fixture/a","retainSeed":false}""")]
|
||||
[InlineData("""{"topic":"otopcua/fixture/a"}""")]
|
||||
public void Mqtt_accepts_a_retainSeed_its_reader_accepts(string blob)
|
||||
{
|
||||
RuntimeAccepts(DriverTypeNames.Mqtt, blob).ShouldBeTrue();
|
||||
TagConfigValidator.Validate(DriverTypeNames.Mqtt, blob).ShouldBeNull();
|
||||
}
|
||||
|
||||
// =============================================================================================
|
||||
// 2. The advisory pin — the caution that shapes the whole implementation.
|
||||
// =============================================================================================
|
||||
|
||||
Reference in New Issue
Block a user