fix(historian): #690 Gateway raw/AtTime Bad rows carry no value (a stored NULL was value 0)

This commit is contained in:
Joseph Doherty
2026-10-12 16:08:54 -04:00
parent 1f5d310071
commit 39552e15b9
6 changed files with 68 additions and 4 deletions
@@ -111,6 +111,21 @@ public sealed class GatewayHistorianDataSourceTests
Assert.Equal(0x80000000u, r.Samples[1].StatusCode); // gap → Bad at requested ts
}
[Fact] // #690: an at-time NULL (histsdk: value 0 + Bad) is null + Bad, like the SQL backends' AtTime of a Bad sample
public async Task ReadAtTime_of_a_NULL_row_carries_no_value()
{
var fake = new FakeHistorianGatewayClient();
var t0 = new DateTime(2026, 1, 1, 0, 0, 0, DateTimeKind.Utc);
fake.AtTimeSamples = new[]
{
new HistorianSample { NumericValue = 0, OpcQuality = 0, Quality = 1, Timestamp = Timestamp.FromDateTime(t0) },
};
var ds = new GatewayHistorianDataSource(fake, NullLogger<GatewayHistorianDataSource>.Instance);
var r = await ds.ReadAtTimeAsync("T", new[] { t0 }, TestContext.Current.CancellationToken);
Assert.Null(r.Samples[0].Value);
Assert.Equal(0x80000000u, r.Samples[0].StatusCode);
}
[Fact]
public async Task Empty_window_is_not_a_fault()
{