fix: preserve SDK 2.0 client value and lifetime contracts
This commit is contained in:
@@ -48,11 +48,15 @@ internal sealed class FakeSessionAdapter : ISessionAdapter
|
||||
public bool ThrowOnBrowse { get; set; }
|
||||
|
||||
/// <summary>Gets or sets the browse references returned by browse operations.</summary>
|
||||
public ReferenceDescriptionCollection BrowseResponse { get; set; } = [];
|
||||
public ArrayOf<ReferenceDescription> BrowseResponse { get; set; } = [];
|
||||
/// <summary>Gets or sets the continuation point for browse operations.</summary>
|
||||
public byte[]? BrowseContinuationPoint { get; set; }
|
||||
public Func<CancellationToken, Task>? BeforeBrowseNext { get; set; }
|
||||
public List<(byte[] Point, bool Cancelled)> BrowseReleases { get; } = [];
|
||||
public bool ThrowOnBrowseRelease { get; set; }
|
||||
|
||||
/// <summary>Gets or sets the browse references returned by browse-next operations.</summary>
|
||||
public ReferenceDescriptionCollection BrowseNextResponse { get; set; } = [];
|
||||
public ArrayOf<ReferenceDescription> BrowseNextResponse { get; set; } = [];
|
||||
/// <summary>Gets or sets the continuation point for browse-next operations.</summary>
|
||||
public byte[]? BrowseNextContinuationPoint { get; set; }
|
||||
|
||||
@@ -129,7 +133,7 @@ internal sealed class FakeSessionAdapter : ISessionAdapter
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<(byte[]? ContinuationPoint, ReferenceDescriptionCollection References)> BrowseAsync(
|
||||
public Task<(byte[]? ContinuationPoint, ArrayOf<ReferenceDescription> References)> BrowseAsync(
|
||||
NodeId nodeId, uint nodeClassMask, CancellationToken ct)
|
||||
{
|
||||
BrowseCount++;
|
||||
@@ -139,11 +143,19 @@ internal sealed class FakeSessionAdapter : ISessionAdapter
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<(byte[]? ContinuationPoint, ReferenceDescriptionCollection References)> BrowseNextAsync(
|
||||
public async Task<(byte[]? ContinuationPoint, ArrayOf<ReferenceDescription> References)> BrowseNextAsync(
|
||||
byte[] continuationPoint, CancellationToken ct)
|
||||
{
|
||||
BrowseNextCount++;
|
||||
return Task.FromResult((BrowseNextContinuationPoint, BrowseNextResponse));
|
||||
if (BeforeBrowseNext != null) await BeforeBrowseNext(ct);
|
||||
return (BrowseNextContinuationPoint, BrowseNextResponse);
|
||||
}
|
||||
|
||||
public Task ReleaseBrowseContinuationPointAsync(byte[] continuationPoint, CancellationToken ct)
|
||||
{
|
||||
BrowseReleases.Add((continuationPoint, ct.IsCancellationRequested));
|
||||
if (ThrowOnBrowseRelease) throw new ServiceResultException(StatusCodes.BadSessionClosed);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user