using Shouldly;
using Xunit;
using ZB.MOM.WW.MxGateway.Contracts.Proto;
using ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Runtime;
namespace ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Tests;
///
/// Driver.Galaxy-019 — pins :
/// a SetBufferedUpdateInterval reply is only "applied" (and therefore cacheable
/// as the last-applied interval) when the gateway returns .
/// means the COM-side set did NOT take
/// effect, so caching it would suppress the retry on the next subscribe — it must classify
/// as not-applied, as must any other unexpected code or a missing status.
///
public sealed class GatewayGalaxySubscriberClassifyTests
{
/// Ok is the only code that records the interval as applied.
[Fact]
public void Ok_classifies_as_applied()
{
GatewayGalaxySubscriber.ClassifyIntervalReply(ProtocolStatusCode.Ok).ShouldBeTrue();
}
/// MxaccessFailure must NOT cache — the COM-side set did not apply.
[Fact]
public void MxaccessFailure_classifies_as_not_applied()
{
GatewayGalaxySubscriber.ClassifyIntervalReply(ProtocolStatusCode.MxaccessFailure).ShouldBeFalse();
}
/// Any other unexpected code is treated as not-applied.
[Fact]
public void Unexpected_code_classifies_as_not_applied()
{
GatewayGalaxySubscriber.ClassifyIntervalReply(ProtocolStatusCode.Unspecified).ShouldBeFalse();
}
/// A missing protocol status (null) is treated as not-applied.
[Fact]
public void Null_classifies_as_not_applied()
{
GatewayGalaxySubscriber.ClassifyIntervalReply(null).ShouldBeFalse();
}
}