public void Enter_如果货载在N位置上_则不会抛出异常() { Location loc1 = NewN(); Location loc2 = NewS(); Unitload u1 = new Unitload(); u1.Enter(loc1); Assert.Throws <InvalidOperationException>(() => u1.Enter(loc2)); }
public void Enter_进入N位置() { Location loc = NewN(); Unitload u1 = new Unitload(); Unitload u2 = new Unitload(); u1.Enter(loc); u2.Enter(loc); Assert.Same(loc, u1.CurrentLocation); Assert.Same(loc, u2.CurrentLocation); Assert.Equal(0, loc.UnitloadCount); }
public async Task 生成任务_如果以N位置作为终点生成非WCS任务_则不会抛出异常() { var start = NewK(); var end = NewN(); Unitload unitload = new Unitload(); unitload.Enter(start); TransportTask task = new TransportTask(); TaskHelper taskHelper = new TaskHelper(For <ISession>(), For <IAppSeqService>(), new UnitloadSnapshopHelper(new DefaultUnitloadSnapshotFactory(), Log.Logger), Log.Logger); await taskHelper.BuildAsync(task, "A", start, end, unitload, false); }
public void LeaveCurrentLocation_离开S位置() { Location loc = NewS(); Unitload u1 = new Unitload(); Unitload u2 = new Unitload(); u1.Enter(loc); u2.Enter(loc); u1.LeaveCurrentLocation(); Assert.Null(u1.CurrentLocation); Assert.Equal(1, loc.UnitloadCount); u2.LeaveCurrentLocation(); Assert.Null(u2.CurrentLocation); Assert.Equal(0, loc.UnitloadCount); }
public async Task 生成任务_如果以N位置作为终点生成WCS任务_则会抛出异常() { var start = NewK(); var end = NewN(); Unitload unitload = new Unitload(); unitload.Enter(start); TransportTask task = new TransportTask(); TaskHelper taskHelper = new TaskHelper(For <ISession>(), For <IAppSeqService>(), new UnitloadSnapshopHelper(new DefaultUnitloadSnapshotFactory(), Log.Logger), Log.Logger); var ex = await Assert.ThrowsAsync <FailToBuildTaskException>(() => taskHelper.BuildAsync(task, "A", start, end, unitload)); Assert.Equal(FailtoBuildTaskReason.NForWcsTask, ex.Reason); }
public async Task 生成任务_如果货载在非N位置上_则任务起点必须与货载当前位置一致() { var start = NewK(); var end = NewS(); Unitload unitload = new Unitload(); unitload.Enter(NewK()); TransportTask task = new TransportTask(); TaskHelper taskHelper = new TaskHelper(For <ISession>(), For <IAppSeqService>(), new UnitloadSnapshopHelper(new DefaultUnitloadSnapshotFactory(), Log.Logger), Log.Logger); var ex = await Assert.ThrowsAsync <FailToBuildTaskException>(() => taskHelper.BuildAsync(task, "test", start, end, unitload)); Assert.Equal(FailtoBuildTaskReason.InvalidStart, ex.Reason); }
public async Task 取消任务_如果起点不是N位置_则货载保持在原位置上() { var start = NewK(); var end = NewK(); Unitload unitload = new Unitload(); unitload.Enter(start); TransportTask task = new TransportTask(); TaskHelper taskHelper = new TaskHelper(For <ISession>(), For <IAppSeqService>(), new UnitloadSnapshopHelper(new DefaultUnitloadSnapshotFactory(), Log.Logger), Log.Logger); await taskHelper.BuildAsync(task, "A", start, end, unitload); await taskHelper.CancelAsync(task); Assert.Same(start, unitload.CurrentLocation); }
public async Task 取消任务_检查货载属性() { var start = NewK(); var end = NewK(); Unitload unitload = new Unitload(); unitload.Enter(start); TransportTask task = new TransportTask(); TaskHelper taskHelper = new TaskHelper(For <ISession>(), For <IAppSeqService>(), new UnitloadSnapshopHelper(new DefaultUnitloadSnapshotFactory(), Log.Logger), Log.Logger); await taskHelper.BuildAsync(task, "A", start, end, unitload); await taskHelper.CancelAsync(task); Assert.False(unitload.BeingMoved); }
public async Task 取消任务_起点的出站数会减少() { var start = NewK(); var end = NewK(); Unitload unitload = new Unitload(); unitload.Enter(start); TransportTask task = new TransportTask(); TaskHelper taskHelper = new TaskHelper(For <ISession>(), For <IAppSeqService>(), new UnitloadSnapshopHelper(new DefaultUnitloadSnapshotFactory(), Log.Logger), Log.Logger); await taskHelper.BuildAsync(task, "A", start, end, unitload); await taskHelper.CancelAsync(task); Assert.Equal(0, start.OutboundCount); }
public async Task 完成任务_如果指定了实际终点_则货载被放在指定的位置上() { var start = NewK(); var end = NewS(); var actualEnd = NewS(); Unitload unitload = new Unitload(); unitload.Enter(start); TransportTask task = new TransportTask(); TaskHelper taskHelper = new TaskHelper(For <ISession>(), For <IAppSeqService>(), new UnitloadSnapshopHelper(new DefaultUnitloadSnapshotFactory(), Log.Logger), Log.Logger); await taskHelper.BuildAsync(task, "A", start, end, unitload); await taskHelper.CompleteAsync(task, actualEnd); Assert.Same(actualEnd, unitload.CurrentLocation); }
public async Task 生成任务_如果货载在N位置上_则任务起点可以为K位置() { var start = NewK(); var end = NewS(); var n = NewN(); Unitload unitload = new Unitload(); unitload.Enter(n); TransportTask task = new TransportTask(); TaskHelper taskHelper = new TaskHelper(For <ISession>(), For <IAppSeqService>(), new UnitloadSnapshopHelper(new DefaultUnitloadSnapshotFactory(), Log.Logger), Log.Logger); await taskHelper.BuildAsync(task, "A", start, end, unitload); Assert.Same(n, unitload.CurrentLocation); Assert.Same(start, task.Start); Assert.Equal(0, n.UnitloadCount); Assert.Equal(0, n.OutboundCount); Assert.Equal(1, start.OutboundCount); }