7500106c2f
Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
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<HistorianValueKind>(), 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<SqlServerHistorianDataSource>();
|
|
p.CreateValueWriter(sp).ShouldBeOfType<SqlServerHistorianValueWriter>();
|
|
p.CreateAlarmWriter(sp).ShouldBeOfType<SqlServerAlarmHistorianWriter>();
|
|
p.CreateProvisioning(sp).ShouldBeOfType<SqlServerTagProvisioner>();
|
|
p.CreateUpdater(sp).ShouldBeOfType<SqlServerHistorianDataUpdater>();
|
|
}
|
|
|
|
private sealed class NullSp : IServiceProvider
|
|
{
|
|
public object? GetService(Type serviceType) => null;
|
|
}
|
|
}
|