28 lines
982 B
C#
28 lines
982 B
C#
using Shouldly;
|
|
using Xunit;
|
|
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions.Tests;
|
|
|
|
/// <summary>Contract tests for the batched data-change payload types.</summary>
|
|
[Trait("Category", "Unit")]
|
|
public sealed class DataChangeBatchContractTests
|
|
{
|
|
private sealed record FakeHandle(string DiagnosticId) : ISubscriptionHandle;
|
|
|
|
/// <summary>Verifies the batch payload carries the subscription handle and its per-tag items.</summary>
|
|
[Fact]
|
|
public void Batch_args_carry_handle_and_items()
|
|
{
|
|
var handle = new FakeHandle("h1");
|
|
var snap = new DataValueSnapshot(42, 0u, DateTime.UtcNow, DateTime.UtcNow);
|
|
|
|
var args = new DataChangeBatchEventArgs(handle, new[] { new DataChangeItem("plc/tag1", snap) });
|
|
|
|
args.SubscriptionHandle.ShouldBe(handle);
|
|
args.Items.Count.ShouldBe(1);
|
|
args.Items[0].FullReference.ShouldBe("plc/tag1");
|
|
args.Items[0].Snapshot.ShouldBe(snap);
|
|
}
|
|
}
|