Merge b626-mtconnect (batch #626+)
Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
@@ -328,4 +328,15 @@ public sealed class MTConnectTagConfigModelTests
|
||||
public void Warnings_is_a_noop_without_probe_metadata()
|
||||
=> MTConnectTagConfigModel.FromJson("{\"fullName\":\"x\",\"dataType\":\"Boolean\"}")
|
||||
.Warnings().ShouldBeEmpty();
|
||||
|
||||
[Fact]
|
||||
public void Warnings_accepts_a_float64_array_for_time_series_and_flags_other_array_types()
|
||||
{
|
||||
MTConnectTagConfigModel.FromJson("{\"fullName\":\"x\",\"dataType\":\"Float64\",\"isArray\":true}")
|
||||
.Warnings().ShouldBeEmpty();
|
||||
|
||||
var m = MTConnectTagConfigModel.FromJson("{\"fullName\":\"x\",\"dataType\":\"Int32\",\"isArray\":true}");
|
||||
m.Warnings().ShouldHaveSingleItem().ShouldContain("Float64");
|
||||
m.Validate().ShouldBeNull(); // advisory only
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,6 +421,25 @@ public sealed class RawTreeServiceWaveBTests
|
||||
result.Error!.ShouldContain("already exists");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CreateDevice_refuses_a_second_device_under_an_MTConnect_driver_but_not_under_others()
|
||||
{
|
||||
var (service, dbName) = Seeded();
|
||||
var mt = await service.CreateDriverAsync(RawTreeTestDb.ClusterId, null, "mt-1", "MTConnect", "{}");
|
||||
mt.Ok.ShouldBeTrue();
|
||||
|
||||
// CreateDriver auto-creates Device1, so the very next device is the ambiguous second one (#628).
|
||||
var refused = await service.CreateDeviceAsync(mt.CreatedId!, "Device2", "{}");
|
||||
|
||||
refused.Ok.ShouldBeFalse();
|
||||
refused.Error!.ShouldContain("one MTConnect driver per agent device");
|
||||
|
||||
// Positive control: the same call against a non-MTConnect driver still succeeds.
|
||||
(await service.CreateDeviceAsync(RawTreeTestDb.FolderedDriverId, "Device9", "{}")).Ok.ShouldBeTrue();
|
||||
using var db = RawTreeTestDb.CreateNamed(dbName);
|
||||
db.Devices.Count(d => d.DriverInstanceId == mt.CreatedId).ShouldBe(1);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------- Merged probe config (Test connect)
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user