feat(central-ui): add Galaxy-type to DataType mapper for secured writes

This commit is contained in:
Joseph Doherty
2026-06-27 13:27:32 -04:00
parent c4daf941d2
commit 265f115a1f
2 changed files with 65 additions and 0 deletions
@@ -0,0 +1,35 @@
using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Pages.Operations;
using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Components;
public class SecuredWriteDataTypeMapperTests
{
[Theory]
[InlineData("Boolean", DataType.Boolean)]
[InlineData("bool", DataType.Boolean)]
[InlineData("Integer", DataType.Int32)]
[InlineData("int", DataType.Int32)]
[InlineData("Int32", DataType.Int32)]
[InlineData("Float", DataType.Float)]
[InlineData("Double", DataType.Double)]
[InlineData("String", DataType.String)]
[InlineData("Time", DataType.DateTime)]
[InlineData(" double ", DataType.Double)] // trimmed + case-insensitive
public void TryMap_known_galaxy_types_map(string galaxy, DataType expected)
{
Assert.True(SecuredWriteDataTypeMapper.TryMap(galaxy, out var dt));
Assert.Equal(expected, dt);
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
[InlineData("ElapsedTime")]
[InlineData("SomeVendorType")]
public void TryMap_unknown_or_blank_returns_false(string? galaxy)
{
Assert.False(SecuredWriteDataTypeMapper.TryMap(galaxy, out _));
}
}