feat(central-ui): add Galaxy-type to DataType mapper for secured writes
This commit is contained in:
+35
@@ -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 _));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user