diff --git a/eModule50/TestUnit/OT/COM/LogisticsUtil/Test_ClassHelper.cs b/eModule50/TestUnit/OT/COM/LogisticsUtil/Test_ClassHelper.cs index 684ab11..3da2bad 100644 --- a/eModule50/TestUnit/OT/COM/LogisticsUtil/Test_ClassHelper.cs +++ b/eModule50/TestUnit/OT/COM/LogisticsUtil/Test_ClassHelper.cs @@ -3,6 +3,7 @@ using OT.COM.LogisticsUtil; using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using Xunit; @@ -160,6 +161,30 @@ namespace TestUnit.OT.COM.LogisticsUtil Assert.True(t == null, $"Create '{i_sTypeName}' success but should not happen"); } } + + public class TestA + { + public int A { get; set; } + } + + [Theory] + [InlineData("3", 3)] + + public void ConvertValue2(object i_oOrigin, object i_tTarget) + { + PropertyInfo pi = typeof(TestA).GetProperties().First(); + object t = ClassHelper.ConvertValue(pi, i_oOrigin); + + if (i_tTarget != null) + { + Assert.True(t != null && t.ToString() == i_tTarget.ToString(), $"Create '{pi}' success but type is not expect '{i_tTarget.ToString()}'"); + } + else + { + Assert.True(t == null, $"Create '{pi}' success but should not happen"); + } + } + } }