fix(dcl): separator-aware alarm routing, typed reply for browse/search while disconnected, server-timestamp fallback (DCL-5, DCL-6, DCL-7, WP3 task 3.4)
This commit is contained in:
+29
@@ -92,4 +92,33 @@ public class OpcUaValueBoundaryTests
|
||||
Assert.Throws<ArgumentException>(() => OpcUaValueBoundary.ToVariant(new object()));
|
||||
Assert.Throws<ArgumentException>(() => OpcUaValueBoundary.ToVariant(new int[2, 2]));
|
||||
}
|
||||
|
||||
/// <summary>DCL-7: the source timestamp wins when present.</summary>
|
||||
[Fact]
|
||||
public void EffectiveTimestamp_PrefersTheSourceTimestamp()
|
||||
{
|
||||
var source = new DateTime(2026, 11, 12, 10, 30, 0, DateTimeKind.Utc);
|
||||
var server = source.AddSeconds(2);
|
||||
Assert.Equal(source, OpcUaValueBoundary.EffectiveTimestamp(source, server));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DCL-7: with <c>TimestampsToReturn = Server</c> (or a server that omits it) there is no source
|
||||
/// timestamp — fall back to the server timestamp, never 0001-01-01.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EffectiveTimestamp_FallsBackToTheServerTimestamp()
|
||||
{
|
||||
var server = new DateTime(2026, 11, 12, 10, 30, 2, DateTimeKind.Utc);
|
||||
Assert.Equal(server, OpcUaValueBoundary.EffectiveTimestamp(DateTimeUtc.MinValue, server));
|
||||
}
|
||||
|
||||
/// <summary>DCL-7: with neither timestamp, the value is stamped now rather than DateTime.MinValue.</summary>
|
||||
[Fact]
|
||||
public void EffectiveTimestamp_WithNeither_IsNow()
|
||||
{
|
||||
var before = DateTime.UtcNow;
|
||||
var ts = OpcUaValueBoundary.EffectiveTimestamp(DateTimeUtc.MinValue, DateTimeUtc.MinValue);
|
||||
Assert.InRange(ts, before, DateTime.UtcNow);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user