test: migrate SDK 2.0 wire contracts and pin baseline aggregate vectors

This commit is contained in:
Joseph Doherty
2026-11-10 10:44:23 -05:00
parent 6aaccb332f
commit aac7c88417
29 changed files with 4695 additions and 362 deletions
@@ -51,7 +51,7 @@ public sealed class ClientAlarmMethodTests
using var client = await ConnectClientAsync(rig, ct);
var conditionId = ConditionNodeId(observer, native: false).ToString();
async Task<VariantCollection> Next(int expectedCount)
async Task<ArrayOf<Variant>> Next(int expectedCount)
{
await rig.DrainProjectionsAsync();
await RecordedEvents.WaitUntilAsync(() => events.ConditionEvents(item, "base").Count >= expectedCount);
@@ -61,27 +61,27 @@ public sealed class ClientAlarmMethodTests
var n = 1;
StatusCode.IsGood(await client.AcknowledgeAlarmAsync(
conditionId, events.LatestEventId(item, "base"), "ack", ct)).ShouldBeTrue();
(await Next(++n))[RecordedEvents.AckedField].Value.ShouldBe(true);
(await Next(++n))[RecordedEvents.AckedField].ClrValue()!.ShouldBe(true);
StatusCode.IsGood(await client.ConfirmAlarmAsync(
conditionId, events.LatestEventId(item, "base"), "confirm", ct)).ShouldBeTrue();
(await Next(++n))[RecordedEvents.ConfirmedField].Value.ShouldBe(true);
(await Next(++n))[RecordedEvents.ConfirmedField].ClrValue()!.ShouldBe(true);
StatusCode.IsGood(await client.AddCommentAsync(
conditionId, events.LatestEventId(item, "base"), "note", ct)).ShouldBeTrue();
((await Next(++n))[RecordedEvents.CommentField].Value as LocalizedText).ShouldNotBeNull().Text.ShouldBe("note");
((await Next(++n))[RecordedEvents.CommentField].ClrValue()! as LocalizedText?).ShouldNotBeNull().Text.ShouldBe("note");
StatusCode.IsGood(await client.ShelveAlarmAsync(conditionId, ShelveKind.OneShot, 0, ct)).ShouldBeTrue();
(await Next(++n))[RecordedEvents.ShelvingField].Value.ShouldBe(ObjectIds.ShelvedStateMachineType_OneShotShelved);
(await Next(++n))[RecordedEvents.ShelvingField].ClrValue()!.ShouldBe(ObjectIds.ShelvedStateMachineType_OneShotShelved);
StatusCode.IsGood(await client.ShelveAlarmAsync(conditionId, ShelveKind.Unshelve, 0, ct)).ShouldBeTrue();
(await Next(++n))[RecordedEvents.ShelvingField].Value.ShouldBe(ObjectIds.ShelvedStateMachineType_Unshelved);
(await Next(++n))[RecordedEvents.ShelvingField].ClrValue()!.ShouldBe(ObjectIds.ShelvedStateMachineType_Unshelved);
StatusCode.IsGood(await client.ShelveAlarmAsync(conditionId, ShelveKind.Timed, 60, ct)).ShouldBeTrue();
(await Next(++n))[RecordedEvents.ShelvingField].Value.ShouldBe(ObjectIds.ShelvedStateMachineType_TimedShelved);
(await Next(++n))[RecordedEvents.ShelvingField].ClrValue()!.ShouldBe(ObjectIds.ShelvedStateMachineType_TimedShelved);
StatusCode.IsGood(await client.ShelveAlarmAsync(conditionId, ShelveKind.Unshelve, 0, ct)).ShouldBeTrue();
(await Next(++n))[RecordedEvents.ShelvingField].Value.ShouldBe(ObjectIds.ShelvedStateMachineType_Unshelved);
(await Next(++n))[RecordedEvents.ShelvingField].ClrValue()!.ShouldBe(ObjectIds.ShelvedStateMachineType_Unshelved);
await subscription.DeleteAsync(true, ct);
}
@@ -113,23 +113,23 @@ public sealed class ClientAlarmMethodTests
var eventId = events.LatestEventId(item, "base");
// Refusals first: they must not disturb the condition, so the ack below still lands as event #2.
(await client.ConfirmAlarmAsync(conditionId, eventId, "confirm", ct)).Code.ShouldBe(StatusCodes.BadNotSupported);
(await client.ShelveAlarmAsync(conditionId, ShelveKind.OneShot, 0, ct)).Code.ShouldBe(StatusCodes.BadNotSupported);
(await client.ShelveAlarmAsync(conditionId, ShelveKind.Timed, 60, ct)).Code.ShouldBe(StatusCodes.BadNotSupported);
(await client.ConfirmAlarmAsync(conditionId, eventId, "confirm", ct)).Code.ShouldBe(StatusCodes.BadNotSupported.Code);
(await client.ShelveAlarmAsync(conditionId, ShelveKind.OneShot, 0, ct)).Code.ShouldBe(StatusCodes.BadNotSupported.Code);
(await client.ShelveAlarmAsync(conditionId, ShelveKind.Timed, 60, ct)).Code.ShouldBe(StatusCodes.BadNotSupported.Code);
StatusCode.IsGood(await client.AcknowledgeAlarmAsync(conditionId, eventId, "ack", ct)).ShouldBeTrue();
await rig.DrainProjectionsAsync();
await RecordedEvents.WaitUntilAsync(() => events.ConditionEvents(item, "base").Count >= 2);
var ack = events.ConditionEvents(item, "base")[1];
ack[RecordedEvents.AckedField].Value.ShouldBe(true);
ack[RecordedEvents.ConfirmedField].Value.ShouldBe(true);
ack[RecordedEvents.ShelvingField].Value.ShouldBe(ObjectIds.ShelvedStateMachineType_Unshelved);
ack[RecordedEvents.AckedField].ClrValue()!.ShouldBe(true);
ack[RecordedEvents.ConfirmedField].ClrValue()!.ShouldBe(true);
ack[RecordedEvents.ShelvingField].ClrValue()!.ShouldBe(ObjectIds.ShelvedStateMachineType_Unshelved);
StatusCode.IsGood(await client.AddCommentAsync(
conditionId, events.LatestEventId(item, "base"), "note", ct)).ShouldBeTrue();
await rig.DrainProjectionsAsync();
await RecordedEvents.WaitUntilAsync(() => events.ConditionEvents(item, "base").Count >= 3);
(events.ConditionEvents(item, "base")[2][RecordedEvents.CommentField].Value as LocalizedText).ShouldNotBeNull().Text.ShouldBe("note");
(events.ConditionEvents(item, "base")[2][RecordedEvents.CommentField].ClrValue()! as LocalizedText?).ShouldNotBeNull().Text.ShouldBe("note");
await subscription.DeleteAsync(true, ct);
}