worker(alarms): synthetic GUID + degraded/source_provider on emitted transitions

This commit is contained in:
Joseph Doherty
2026-06-13 09:14:23 -04:00
parent 60d35a914f
commit 57d5a8725f
6 changed files with 142 additions and 3 deletions
@@ -0,0 +1,27 @@
using System;
using ZB.MOM.WW.MxGateway.Worker.MxAccess;
namespace ZB.MOM.WW.MxGateway.Worker.Tests.MxAccess;
/// <summary>
/// Unit tests for <see cref="SyntheticAlarmGuid"/>: the subtag-fallback
/// path derives a deterministic GUID from the alarm reference, so identical
/// references must collide and distinct references must not.
/// </summary>
public sealed class SyntheticAlarmGuidTests
{
/// <summary>Verifies the same reference yields the same GUID.</summary>
[Fact]
public void SameReference_SameGuid() =>
Assert.Equal(SyntheticAlarmGuid.ForReference("A.B.C"), SyntheticAlarmGuid.ForReference("A.B.C"));
/// <summary>Verifies distinct references yield distinct GUIDs.</summary>
[Fact]
public void DifferentReference_DifferentGuid() =>
Assert.NotEqual(SyntheticAlarmGuid.ForReference("A.B.C"), SyntheticAlarmGuid.ForReference("A.B.D"));
/// <summary>Verifies a reference produces a non-empty GUID.</summary>
[Fact]
public void Reference_ProducesNonEmptyGuid() =>
Assert.NotEqual(Guid.Empty, SyntheticAlarmGuid.ForReference("A.B.C"));
}