using Microsoft.Extensions.DependencyInjection;
using Xunit;
using ZB.MOM.WW.OtOpcUa.Core.AlarmHistorian;
using ZB.MOM.WW.OtOpcUa.Runtime.Historian;
namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Gateway.Tests;
///
/// Alarm-write cutover seam test (T13). The Host's AddAlarmHistorian wiring drains the durable
/// SqliteStoreAndForwardSink through this factory, so it must yield the gateway-backed writer —
/// sourcing the single gateway's connection from (endpoint/key/TLS),
/// not the legacy Wonderware-shaped AlarmHistorian host/port. Built offline: the underlying
/// channel dials lazily, so both the factory and the writer ctor perform no network I/O (a bogus,
/// unreachable endpoint must construct without throwing or connecting).
///
public sealed class GatewayAlarmWriterFactoryTests
{
[Fact]
public void Factory_builds_GatewayAlarmHistorianWriter()
{
var opts = new ServerHistorianOptions { Enabled = true, Endpoint = "https://localhost:5222", ApiKey = "histgw_x_y" };
using var services = new ServiceCollection().BuildServiceProvider();
IAlarmHistorianWriter writer = GatewayHistorian.CreateAlarmWriter(opts, services);
Assert.IsType(writer);
}
}