fix(uns): reject equipment bind to non-existent driver + modal-xl (review)
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user