fix: preserve SDK 2.0 client value and lifetime contracts

This commit is contained in:
Joseph Doherty
2026-11-10 10:19:42 -05:00
parent 0ecea3c6be
commit 3ca06e1b87
38 changed files with 591 additions and 186 deletions
@@ -61,7 +61,7 @@ public class HistoryReadCommandTests
fakeService.HistoryReadRawCalls.Count.ShouldBe(1);
fakeService.HistoryReadRawCalls[0].MaxValues.ShouldBe(500);
fakeService.HistoryReadRawCalls[0].NodeId.Identifier.ShouldBe("HistNode");
fakeService.HistoryReadRawCalls[0].NodeId.IdentifierAsString.ShouldBe("HistNode");
}
/// <summary>Verifies AggregateRead execution calls HistoryReadAggregate.</summary>
@@ -211,11 +211,11 @@ public class HistoryReadCommandTests
var call = fakeService.HistoryReadEventsCalls.ShouldHaveSingleItem();
call.MaxEvents.ShouldBe(25);
call.Filter.SelectClauses.Select(c => c.BrowsePath.ShouldHaveSingleItem().Name)
call.Filter.SelectClauses.ToArray()!.Select(c => c.BrowsePath.ToArray()!.ShouldHaveSingleItem().Name)
.ShouldBe(["EventId", "EventType", "Time", "SourceName", "Severity", "Message", "ConditionName", "SourceNode"]);
call.Filter.SelectClauses.Single(c => c.BrowsePath[0].Name == "ConditionName").TypeDefinitionId
call.Filter.SelectClauses.ToArray()!.Single(c => c.BrowsePath[0].Name == "ConditionName").TypeDefinitionId
.ShouldBe(ObjectTypeIds.ConditionType);
call.Filter.WhereClause.Elements.ShouldBeEmpty("no --of-type, no where-clause");
call.Filter.WhereClause.Elements.ToArray()!.ShouldBeEmpty("no --of-type, no where-clause");
fakeService.HistoryReadRawCalls.ShouldBeEmpty();
var output = TestConsoleHelper.GetOutput(console);
@@ -243,10 +243,10 @@ public class HistoryReadCommandTests
await command.ExecuteAsync(console);
var filter = fakeService.HistoryReadEventsCalls.ShouldHaveSingleItem().Filter;
filter.SelectClauses.Select(c => c.BrowsePath[0].Name).ShouldBe(["EventType", "Severity"]);
var element = filter.WhereClause.Elements.ShouldHaveSingleItem();
filter.SelectClauses.ToArray()!.Select(c => c.BrowsePath[0].Name).ShouldBe(["EventType", "Severity"]);
var element = filter.WhereClause.Elements.ToArray()!.ShouldHaveSingleItem();
element.FilterOperator.ShouldBe(FilterOperator.OfType);
((LiteralOperand)ExtensionObject.ToEncodeable(element.FilterOperands[0])).Value.Value
(element.FilterOperands[0].TryGetValue(out LiteralOperand? literal) ? literal.Value : Variant.Null)
.ShouldBe(ObjectTypeIds.LimitAlarmType);
TestConsoleHelper.GetOutput(console).ShouldContain("0 events returned.");
}