using Shouldly;
using Xunit;
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
using ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Proxy;

namespace ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Proxy.Tests;

[Trait("Category", "Unit")]
public sealed class AggregateColumnMappingTests
{
    [Theory]
    [InlineData(HistoryAggregateType.Average, "Average")]
    [InlineData(HistoryAggregateType.Minimum, "Minimum")]
    [InlineData(HistoryAggregateType.Maximum, "Maximum")]
    [InlineData(HistoryAggregateType.Count, "ValueCount")]
    public void Maps_OpcUa_enum_to_AnalogSummary_column(HistoryAggregateType aggregate, string expected)
    {
        GalaxyProxyDriver.MapAggregateToColumn(aggregate).ShouldBe(expected);
    }

    [Fact]
    public void Total_is_not_supported()
    {
        Should.Throw<System.NotSupportedException>(
            () => GalaxyProxyDriver.MapAggregateToColumn(HistoryAggregateType.Total));
    }
}
