feat(sphistorianclient): port SDK source + tests, rebrand namespace to ZB.MOM.WW.SPHistorianClient

This commit is contained in:
Joseph Doherty
2026-06-19 05:45:06 -04:00
parent 965f5006f2
commit 63cddfb65b
105 changed files with 11454 additions and 0 deletions
@@ -0,0 +1,45 @@
using ZB.MOM.WW.SPHistorianClient.Wcf;
namespace ZB.MOM.WW.SPHistorianClient.Tests;
public sealed class WcfStatusProtocolTests
{
[Fact]
public void SystemTimeParserReadsWindowsSystemTimeLayout()
{
byte[] buffer =
[
0xEA, 0x07,
0x04, 0x00,
0x04, 0x00,
0x1E, 0x00,
0x0D, 0x00,
0x2A, 0x00,
0x07, 0x00,
0x7B, 0x00
];
DateTime? parsed = HistorianStatusProtocol.TryReadSystemTime(buffer);
Assert.Equal(new DateTime(2026, 4, 30, 13, 42, 7, 123), parsed);
}
[Fact]
public void SystemTimeParserRejectsShortAndInvalidBuffers()
{
Assert.Null(HistorianStatusProtocol.TryReadSystemTime([0xEA, 0x07]));
byte[] invalidMonth =
[
0xEA, 0x07,
0x00, 0x00,
0x04, 0x00,
0x1E, 0x00,
0x0D, 0x00,
0x2A, 0x00,
0x07, 0x00,
0x7B, 0x00
];
Assert.Null(HistorianStatusProtocol.TryReadSystemTime(invalidMonth));
}
}