ab57e53b92
- Driver.AbCip.Contracts-001: parse 'writable' from TagConfig JSON (default true) instead of hardcoding - Driver.AbCip.Contracts-002/-003: Dt type comment; drop dead [Display]/[Range] annotations - Driver.AbCip.Contracts-004: dedicated AbCipEquipmentTagParser test class (+15) - Driver.AbCip-017: document Tick severity Low-fallback on Bad severity read - Driver.AbLegacy.Contracts-002/-003/-004: isArray-scalar remarks (+tests), MaxTagBytes/ForFamily docs - Driver.Galaxy.Browser-003 + Driver.Galaxy.Contracts-003: extract ResolveApiKey -> GalaxySecretRef (dedup) - Driver.Galaxy-019: cache buffered-interval only on Ok + ILogger warnings + ClassifyIntervalReply (+tests) - Driver.FOCAS.Contracts-002: thread WriteIdempotent through DiscoverAsync (+test)
46 lines
1.8 KiB
C#
46 lines
1.8 KiB
C#
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;
|
|
|
|
/// <summary>
|
|
/// Driver.Galaxy-019 — pins <see cref="GatewayGalaxySubscriber.ClassifyIntervalReply"/>:
|
|
/// a <c>SetBufferedUpdateInterval</c> reply is only "applied" (and therefore cacheable
|
|
/// as the last-applied interval) when the gateway returns <see cref="ProtocolStatusCode.Ok"/>.
|
|
/// <see cref="ProtocolStatusCode.MxaccessFailure"/> 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.
|
|
/// </summary>
|
|
public sealed class GatewayGalaxySubscriberClassifyTests
|
|
{
|
|
/// <summary>Ok is the only code that records the interval as applied.</summary>
|
|
[Fact]
|
|
public void Ok_classifies_as_applied()
|
|
{
|
|
GatewayGalaxySubscriber.ClassifyIntervalReply(ProtocolStatusCode.Ok).ShouldBeTrue();
|
|
}
|
|
|
|
/// <summary>MxaccessFailure must NOT cache — the COM-side set did not apply.</summary>
|
|
[Fact]
|
|
public void MxaccessFailure_classifies_as_not_applied()
|
|
{
|
|
GatewayGalaxySubscriber.ClassifyIntervalReply(ProtocolStatusCode.MxaccessFailure).ShouldBeFalse();
|
|
}
|
|
|
|
/// <summary>Any other unexpected code is treated as not-applied.</summary>
|
|
[Fact]
|
|
public void Unexpected_code_classifies_as_not_applied()
|
|
{
|
|
GatewayGalaxySubscriber.ClassifyIntervalReply(ProtocolStatusCode.Unspecified).ShouldBeFalse();
|
|
}
|
|
|
|
/// <summary>A missing protocol status (null) is treated as not-applied.</summary>
|
|
[Fact]
|
|
public void Null_classifies_as_not_applied()
|
|
{
|
|
GatewayGalaxySubscriber.ClassifyIntervalReply(null).ShouldBeFalse();
|
|
}
|
|
}
|