Group all 69 projects into category subfolders under src/ and tests/ so the Rider Solution Explorer mirrors the module structure. Folders: Core, Server, Drivers (with a nested Driver CLIs subfolder), Client, Tooling. - Move every project folder on disk with git mv (history preserved as renames). - Recompute relative paths in 57 .csproj files: cross-category ProjectReferences, the lib/ HintPath+None refs in Driver.Historian.Wonderware, and the external mxaccessgw refs in Driver.Galaxy and its test project. - Rebuild ZB.MOM.WW.OtOpcUa.slnx with nested solution folders. - Re-prefix project paths in functional scripts (e2e, compliance, smoke SQL, integration, install). Build green (0 errors); unit tests pass. Docs left for a separate pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
110 lines
2.5 KiB
C#
110 lines
2.5 KiB
C#
using Shouldly;
|
|
using Xunit;
|
|
using ZB.MOM.WW.OtOpcUa.Client.Shared.Helpers;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Tests.Helpers;
|
|
|
|
public class ValueConverterTests
|
|
{
|
|
[Fact]
|
|
public void ConvertValue_Bool_True()
|
|
{
|
|
ValueConverter.ConvertValue("True", true).ShouldBe(true);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_Bool_False()
|
|
{
|
|
ValueConverter.ConvertValue("False", false).ShouldBe(false);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_Byte()
|
|
{
|
|
ValueConverter.ConvertValue("255", (byte)0).ShouldBe((byte)255);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_Short()
|
|
{
|
|
ValueConverter.ConvertValue("-100", (short)0).ShouldBe((short)-100);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_UShort()
|
|
{
|
|
ValueConverter.ConvertValue("65535", (ushort)0).ShouldBe((ushort)65535);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_Int()
|
|
{
|
|
ValueConverter.ConvertValue("42", 0).ShouldBe(42);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_UInt()
|
|
{
|
|
ValueConverter.ConvertValue("42", 0u).ShouldBe(42u);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_Long()
|
|
{
|
|
ValueConverter.ConvertValue("9999999999", 0L).ShouldBe(9999999999L);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_ULong()
|
|
{
|
|
ValueConverter.ConvertValue("18446744073709551615", 0UL).ShouldBe(ulong.MaxValue);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_Float()
|
|
{
|
|
ValueConverter.ConvertValue("3.14", 0f).ShouldBe(3.14f);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_Double()
|
|
{
|
|
ValueConverter.ConvertValue("3.14159", 0.0).ShouldBe(3.14159);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_String_WhenCurrentIsString()
|
|
{
|
|
ValueConverter.ConvertValue("hello", "").ShouldBe("hello");
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_String_WhenCurrentIsNull()
|
|
{
|
|
ValueConverter.ConvertValue("hello", null).ShouldBe("hello");
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_String_WhenCurrentIsUnknownType()
|
|
{
|
|
ValueConverter.ConvertValue("hello", new object()).ShouldBe("hello");
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_InvalidBool_Throws()
|
|
{
|
|
Should.Throw<FormatException>(() => ValueConverter.ConvertValue("notabool", true));
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_InvalidInt_Throws()
|
|
{
|
|
Should.Throw<FormatException>(() => ValueConverter.ConvertValue("notanint", 0));
|
|
}
|
|
|
|
[Fact]
|
|
public void ConvertValue_Overflow_Throws()
|
|
{
|
|
Should.Throw<OverflowException>(() => ValueConverter.ConvertValue("256", (byte)0));
|
|
}
|
|
} |