using Shouldly; using Xunit; using ZB.MOM.WW.OtOpcUa.Commons.Types; namespace ZB.MOM.WW.OtOpcUa.Commons.Tests; /// /// lmxopcua#1040 (#978 follow-up): the effective-name rule is stated once /// () — an EMPTY override means "no override". Every other /// helper on the map must agree with it, including , which /// used ?? and so dropped an empty-override reference instead of naming it after its tag. /// public sealed class EquipmentReferenceMapEffectiveNameTests { [Theory] [InlineData(null, "Speed", "Speed")] [InlineData("", "Speed", "Speed")] [InlineData("Rate", "Speed", "Rate")] public void EffectiveName_empty_override_is_no_override(string? displayNameOverride, string tagName, string expected) => EquipmentReferenceMap.EffectiveName(displayNameOverride, tagName).ShouldBe(expected); [Fact] public void EffectiveNames_agrees_with_EffectiveName_for_an_empty_override() { var names = EquipmentReferenceMap.EffectiveNames( [ new EquipmentReferenceMap.ReferenceRow("R1", "EQ-1", "T1", ""), new EquipmentReferenceMap.ReferenceRow("R2", "EQ-1", "T2", null), new EquipmentReferenceMap.ReferenceRow("R3", "EQ-1", "T3", "Override"), ], new Dictionary { ["T1"] = "Speed", ["T2"] = "Temp", ["T3"] = "Level" }); names.ShouldBe(["Speed", "Temp", "Override"], ignoreOrder: true); } }