chore: organize solution into module folders (Core/Server/Drivers/Client/Tooling)

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>
This commit is contained in:
Joseph Doherty
2026-05-17 01:55:28 -04:00
parent 69f02fed7f
commit a25593a9c6
1044 changed files with 365 additions and 343 deletions

View File

@@ -0,0 +1,126 @@
using Google.Protobuf.WellKnownTypes;
using MxGateway.Contracts.Proto;
using Shouldly;
using Xunit;
using ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Runtime;
namespace ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Tests.Runtime;
/// <summary>
/// Tests for <see cref="MxValueEncoder"/>. Pinning each scalar + array case here
/// guards against accidental drift in the IWritable wire format.
/// </summary>
public sealed class MxValueEncoderTests
{
[Fact]
public void Encode_Null_SetsIsNullFlag()
{
var v = MxValueEncoder.Encode(null);
v.IsNull.ShouldBeTrue();
}
[Fact]
public void Encode_Bool() => MxValueEncoder.Encode(true).BoolValue.ShouldBe(true);
[Theory]
[InlineData((sbyte)-5, -5)]
[InlineData((short)-1000, -1000)]
[InlineData((byte)42, 42)]
[InlineData((ushort)42_000, 42_000)]
public void Encode_NarrowSignedAndUnsigned_FitsInInt32(object input, int expected)
{
var v = MxValueEncoder.Encode(input);
v.KindCase.ShouldBe(MxValue.KindOneofCase.Int32Value);
v.Int32Value.ShouldBe(expected);
}
[Fact]
public void Encode_Int32_RoundTrip() => MxValueEncoder.Encode(int.MinValue).Int32Value.ShouldBe(int.MinValue);
[Fact]
public void Encode_Int64_RoundTrip()
{
var v = MxValueEncoder.Encode(long.MaxValue);
v.KindCase.ShouldBe(MxValue.KindOneofCase.Int64Value);
v.Int64Value.ShouldBe(long.MaxValue);
}
[Fact]
public void Encode_UInt32_FitsInInt32() => MxValueEncoder.Encode((uint)int.MaxValue).Int32Value.ShouldBe(int.MaxValue);
[Fact]
public void Encode_Float() => MxValueEncoder.Encode(3.14f).FloatValue.ShouldBe(3.14f);
[Fact]
public void Encode_Double() => MxValueEncoder.Encode(2.71828).DoubleValue.ShouldBe(2.71828);
[Fact]
public void Encode_String() => MxValueEncoder.Encode("hello").StringValue.ShouldBe("hello");
[Fact]
public void Encode_DateTimeUtc()
{
var when = new DateTime(2026, 4, 29, 12, 0, 0, DateTimeKind.Utc);
var v = MxValueEncoder.Encode(when);
v.TimestampValue.ShouldNotBeNull();
v.TimestampValue.ToDateTime().ShouldBe(when);
}
[Fact]
public void Encode_DateTimeLocal_ConvertsToUtc()
{
var local = new DateTime(2026, 4, 29, 12, 0, 0, DateTimeKind.Local);
var v = MxValueEncoder.Encode(local);
v.TimestampValue.ToDateTime().ShouldBe(local.ToUniversalTime());
}
[Fact]
public void Encode_BoolArray()
{
var v = MxValueEncoder.Encode(new[] { true, false, true });
v.ArrayValue.BoolValues.Values.ToArray().ShouldBe(new[] { true, false, true });
v.ArrayValue.Dimensions[0].ShouldBe(3u);
}
[Fact]
public void Encode_DoubleArray()
{
var v = MxValueEncoder.Encode(new[] { 1.0, 2.0, 3.5 });
v.ArrayValue.DoubleValues.Values.ToArray().ShouldBe(new[] { 1.0, 2.0, 3.5 });
}
[Fact]
public void Encode_StringArray()
{
var v = MxValueEncoder.Encode(new[] { "a", "b" });
v.ArrayValue.StringValues.Values.ToArray().ShouldBe(new[] { "a", "b" });
}
[Fact]
public void Encode_DateTimeArray_ConvertsAllToUtc()
{
var inputs = new[] { new DateTime(2026, 4, 29, 0, 0, 0, DateTimeKind.Utc) };
var v = MxValueEncoder.Encode(inputs);
v.ArrayValue.TimestampValues.Values[0].ToDateTime().ShouldBe(inputs[0]);
}
[Fact]
public void Encode_UnsupportedType_Throws()
{
Should.Throw<ArgumentException>(() => MxValueEncoder.Encode(new { Foo = 1 }));
}
[Fact]
public void RoundTrip_AllScalarTypes_DecodeMatchesOriginal()
{
// The encoder + decoder must be inverses for every scalar a Galaxy driver might
// hand to a write. This pin-test catches accidental drift in either direction.
object[] inputs = [true, 42, 12345L, 3.14f, 2.71828, "x"];
foreach (var input in inputs)
{
var encoded = MxValueEncoder.Encode(input);
var decoded = MxValueDecoder.Decode(encoded);
decoded.ShouldBe(input);
}
}
}