test(adminui): browse session registry, reaper, service

This commit is contained in:
Joseph Doherty
2026-05-28 15:44:20 -04:00
parent d605d0b20d
commit dc8a2dd52c
6 changed files with 366 additions and 0 deletions
@@ -0,0 +1,22 @@
using ZB.MOM.WW.OtOpcUa.Commons.Browsing;
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Tests.Browsing;
/// <summary>Test double for <see cref="IDriverBrowser"/>. The constructor sets
/// <see cref="DriverType"/>; <see cref="OpenAsync"/> delegates to the caller-supplied
/// <see cref="OpenHandler"/> or returns a fresh <see cref="FakeBrowseSession"/>.</summary>
internal sealed class FakeDriverBrowser(string driverType) : IDriverBrowser
{
/// <inheritdoc />
public string DriverType { get; } = driverType;
/// <summary>Override for <see cref="OpenAsync"/>; if null, a fresh
/// <see cref="FakeBrowseSession"/> is returned.</summary>
#pragma warning disable CS0649
public Func<string, CancellationToken, Task<IBrowseSession>>? OpenHandler;
#pragma warning restore CS0649
/// <inheritdoc />
public Task<IBrowseSession> OpenAsync(string configJson, CancellationToken ct)
=> OpenHandler?.Invoke(configJson, ct) ?? Task.FromResult<IBrowseSession>(new FakeBrowseSession());
}