using Shouldly; using Xunit; using ZB.MOM.WW.OtOpcUa.Core.Abstractions; namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.SqlServer.Tests; public sealed class SqlServerHistorianProviderTests { private static SqlServerHistorianProvider Make() => new(new SqlServerHistorianOptions { ConnectionString = "Server=localhost;User Id=sa;Password=x;TrustServerCertificate=True", }); [Fact] public void Name_and_all_six_kinds() { var p = Make(); p.Name.ShouldBe("SqlServer"); p.SupportedKinds.ShouldBe(Enum.GetValues(), ignoreOrder: true); p.SupportedKinds.Count.ShouldBe(6); } [Fact] public void Creates_all_five_seams_without_touching_sql() { var sp = new NullSp(); var p = Make(); p.CreateDataSource(sp).ShouldBeOfType(); p.CreateValueWriter(sp).ShouldBeOfType(); p.CreateAlarmWriter(sp).ShouldBeOfType(); p.CreateProvisioning(sp).ShouldBeOfType(); p.CreateUpdater(sp).ShouldBeOfType(); } private sealed class NullSp : IServiceProvider { public object? GetService(Type serviceType) => null; } }