6ea3ba44da
IHistorianDataSource.SupportedAggregates (default: every HistoryAggregateType) is the one authority for both ServerCapabilities/AggregateFunctions (i=2997) and HistoryServerCapabilities/AggregateFunctions (i=11201) and for the up-front BadAggregateNotSupported in HistoryRead-Processed. Gateway declares AggregateModeMapper.Served (4), SqlServer/QuestDB AggregateFamilies.Served (17), Null none. Only the folder references are trimmed; the SDK's calculator factories stay so live AggregateFilter subscriptions keep working. Co-Authored-By: Claude <noreply@anthropic.com>
32 lines
1.6 KiB
C#
32 lines
1.6 KiB
C#
using Shouldly;
|
|
using Xunit;
|
|
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Sql.Common.Tests;
|
|
|
|
/// <summary>The DB-free part of the former SQL Server integration <c>ProcessedReadTests</c>.</summary>
|
|
public sealed class ProcessedReadTests
|
|
{
|
|
[Fact]
|
|
public void Every_enum_member_is_either_served_or_refused()
|
|
{
|
|
// Seventeen served (#671 added TimeAverage, TimeAverage2, Interpolative and Total2, and moved Total to the
|
|
// time-weighted family; #680 moved PercentGood/PercentBad there too — they are duration-based); anything appended to
|
|
// the enum later falls to the refusal (total default).
|
|
Enum.GetValues<HistoryAggregateType>().Count(a => AggregateFamilies.FamilyOf(a) is not null).ShouldBe(17);
|
|
Enum.GetValues<HistoryAggregateType>().Where(a => AggregateFamilies.FamilyOf(a) == AggregateFamily.TimeWeighted)
|
|
.ShouldBe([HistoryAggregateType.Total, HistoryAggregateType.Interpolative, HistoryAggregateType.TimeAverage,
|
|
HistoryAggregateType.PercentGood, HistoryAggregateType.PercentBad, HistoryAggregateType.TimeAverage2,
|
|
HistoryAggregateType.Total2]);
|
|
}
|
|
|
|
[Fact]
|
|
public void Served_is_exactly_the_members_with_a_family()
|
|
{
|
|
// #682: the advertised set and the dispatch are one definition — a member is served iff it has a family.
|
|
AggregateFamilies.Served.Count.ShouldBe(17);
|
|
foreach (var a in Enum.GetValues<HistoryAggregateType>())
|
|
AggregateFamilies.Served.Contains(a).ShouldBe(AggregateFamilies.FamilyOf(a) is not null, a.ToString());
|
|
}
|
|
}
|