feat(historian-gateway): reshape ServerHistorianOptions to gateway form (Endpoint/ApiKey/Tls)

Claude-Session: https://claude.ai/code/session_012SDSQ3AcaXqPcBtDESBRii
This commit is contained in:
Joseph Doherty
2026-06-26 16:52:56 -04:00
parent 35aace7fdf
commit 718f1fdad2
3 changed files with 87 additions and 65 deletions
@@ -0,0 +1,34 @@
using Xunit;
using ZB.MOM.WW.OtOpcUa.Runtime.Historian;
namespace ZB.MOM.WW.OtOpcUa.Runtime.Tests.Historian;
/// <summary>
/// Covers the gateway-shaped <see cref="ServerHistorianOptions.Validate"/> warnings: a disabled or
/// correctly-configured historian is silent; an enabled one with a blank <c>Endpoint</c> or blank
/// <c>ApiKey</c> surfaces an operator-facing warning (carrying no secret value text).
/// </summary>
public sealed class ServerHistorianOptionsTests
{
[Fact]
public void Disabled_yields_no_warnings()
=> Assert.Empty(new ServerHistorianOptions { Enabled = false }.Validate());
[Fact]
public void Enabled_without_endpoint_warns()
{
var w = new ServerHistorianOptions { Enabled = true, Endpoint = "", ApiKey = "histgw_x_y" }.Validate();
Assert.Contains(w, m => m.Contains("Endpoint"));
}
[Fact]
public void Enabled_without_apikey_warns()
{
var w = new ServerHistorianOptions { Enabled = true, Endpoint = "https://h:5222", ApiKey = "" }.Validate();
Assert.Contains(w, m => m.Contains("ApiKey"));
}
[Fact]
public void Valid_config_is_clean()
=> Assert.Empty(new ServerHistorianOptions { Enabled = true, Endpoint = "https://h:5222", ApiKey = "histgw_x_y" }.Validate());
}