feat(core): add IBatchSubscribable batch data-change contract
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.Core.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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user