682ab34137
The two sites the issue named (DataConnectionValidator, LocalExportCatalog line 56) were already converted by #1002; the remaining inline copies were not. EquipmentReferenceMap.EffectiveNames itself used '??', so an empty override dropped the reference instead of naming it after its tag; the artifact-side ACL resolver used IsNullOrWhiteSpace. Both now agree with the one rule, as do the UnsTreeService rows, the composer and the local-export alarm reservation.
36 lines
1.6 KiB
C#
36 lines
1.6 KiB
C#
using Shouldly;
|
|
using Xunit;
|
|
using ZB.MOM.WW.OtOpcUa.Commons.Types;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Commons.Tests;
|
|
|
|
/// <summary>
|
|
/// lmxopcua#1040 (#978 follow-up): the effective-name rule is stated once
|
|
/// (<see cref="EquipmentReferenceMap.EffectiveName"/>) — an EMPTY override means "no override". Every other
|
|
/// helper on the map must agree with it, including <see cref="EquipmentReferenceMap.EffectiveNames"/>, which
|
|
/// used <c>??</c> and so dropped an empty-override reference instead of naming it after its tag.
|
|
/// </summary>
|
|
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<string, string> { ["T1"] = "Speed", ["T2"] = "Temp", ["T3"] = "Level" });
|
|
|
|
names.ShouldBe(["Speed", "Temp", "Override"], ignoreOrder: true);
|
|
}
|
|
}
|