f0700571e8
51 new test cases (34 methods) in Sql.Common.Tests covering AtTimeEvaluator, AggregateEvaluator (hand-built tag-A bucket rows, ProcessedRead literals), BucketPlan, LiveWritePreparer and HistoryUpdatePlanner (incl. resolutionTicks=10 truncate-before-dedup and the superseded-duplicate outcome), plus EventContinuation, HistorianHealthCounters, ClampSeverity and StoredSample.FromStored. Each was falsified by reverting the rule it pins (37 mutations, all red, all restored). Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
38 lines
1.7 KiB
C#
38 lines
1.7 KiB
C#
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Sql.Common.Tests;
|
|
|
|
/// <summary>The SqlServer integration fixture's time base and tag A, as plain values (no database).</summary>
|
|
internal static class Fixture
|
|
{
|
|
/// <summary>2026-10-09 08:00:00.1234567 UTC — deliberately not millisecond-aligned (same as ReadTestDb.T0).</summary>
|
|
public static readonly DateTime T0 = new DateTime(2026, 10, 9, 8, 0, 0, DateTimeKind.Utc).AddTicks(1_234_567);
|
|
|
|
public const uint Good = 0x00000000u;
|
|
public const uint Bad = 0x80000000u;
|
|
public const uint BadNoCommunication = 0x80310000u;
|
|
public const uint Uncertain = 0x40000000u;
|
|
|
|
// Hand-computed literals, copied from the SqlServer integration tests.
|
|
public const uint GoodInterpolated = 0x00000402u;
|
|
public const uint UncertainInterpolated = 0x40A40402u;
|
|
public const uint GoodCalc = 0x00000401u;
|
|
public const uint UncertainCalc = 0x40A40401u;
|
|
public const uint NoDataCalc = 0x809B0401u;
|
|
public const uint InvalidInputsCalc = 0x80D60401u;
|
|
|
|
public static DateTime At(double seconds) => T0.AddTicks((long)(seconds * TimeSpan.TicksPerSecond));
|
|
|
|
public static StoredSample S(double seconds, HistorianValue v, uint status) => new(At(seconds), v, status);
|
|
|
|
/// <summary>Tag A: +0=10, +10=20, +20=Bad(30), +30=40, +40=50 (Double).</summary>
|
|
public static readonly StoredSample[] A =
|
|
[
|
|
S(0, HistorianValue.FromDouble(10), Good),
|
|
S(10, HistorianValue.FromDouble(20), Good),
|
|
S(20, HistorianValue.FromDouble(30), Bad),
|
|
S(30, HistorianValue.FromDouble(40), Good),
|
|
S(40, HistorianValue.FromDouble(50), Good),
|
|
];
|
|
}
|