fix(uns): reject equipment bind to non-existent driver + modal-xl (review)

This commit is contained in:
Joseph Doherty
2026-06-08 13:38:33 -04:00
parent 2beaa43d60
commit d637b834b9
3 changed files with 27 additions and 2 deletions
@@ -192,6 +192,26 @@ public sealed class UnsTreeServiceEquipmentTests
verify.Equipment.Any(e => e.MachineCode == "machine_001").ShouldBeFalse();
}
/// <summary>Binding equipment to a DriverInstanceId that does not exist is blocked with a "not found" error.</summary>
[Fact]
public async Task CreateEquipment_driver_not_found_blocked()
{
var (service, dbName) = Fresh();
// Seed area + line in MAIN cluster, but NO DriverInstance.
SeedLineAndDriver(dbName, lineCluster: "MAIN", driverCluster: null);
var result = await service.CreateEquipmentAsync(
Input("machine-1", "machine_001", "LINE-1", "DRV-GHOST"));
result.Ok.ShouldBeFalse();
result.Error.ShouldNotBeNull();
result.Error.ShouldContain("not found");
result.Error.ShouldContain("DRV-GHOST");
using var db = UnsTreeTestDb.CreateNamed(dbName);
db.Equipment.Any(e => e.MachineCode == "machine_001").ShouldBeFalse();
}
// ----- UpdateEquipment -----
/// <summary>Updating equipment changes its mutable fields (name, MachineCode, a 40010 field).</summary>