refactor(commons): defensive legacy-parse + FromFlatDict starts from POCO defaults
This commit is contained in:
@@ -114,6 +114,21 @@ public class OpcUaEndpointConfigSerializerTests
|
||||
Assert.Equal("opc.tcp://x:4840", config.EndpointUrl);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("not json at all")]
|
||||
[InlineData("[1,2,3]")]
|
||||
[InlineData("{\"foo\":123}")]
|
||||
[InlineData("\"just a string\"")]
|
||||
public void Deserialize_Malformed_ReturnsDefaultsAsLegacy(string input)
|
||||
{
|
||||
var (config, isLegacy) = OpcUaEndpointConfigSerializer.Deserialize(input);
|
||||
|
||||
Assert.True(isLegacy);
|
||||
Assert.Equal("", config.EndpointUrl);
|
||||
Assert.Equal(60000, config.SessionTimeoutMs);
|
||||
Assert.Null(config.Heartbeat);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToFlatDict_OmitsNullHeartbeat()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user