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:
Joseph Doherty
2026-12-03 10:04:02 -05:00
parent d52aff1bee
commit c000ee3203
8 changed files with 267 additions and 25 deletions
@@ -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);
}
}