private StartJob ( System.Guid jobId ) : IHttpActionResult | ||
jobId | System.Guid | |
Результат | IHttpActionResult |
public void StartJobShouldReturnOkIfJobIdMatchPrepareJobId() { _workerWrapper = new WorkerWrapper(new ShortRunningInvokeHandlerFake(), _nodeConfigurationFake, _nodeStartupNotification, _pingToManagerFake, _sendJobDoneTimer, _sendJobCanceledTimer, _sendJobFaultedTimer, _trySendJobDetailToManagerTimerFake); _nodeController = new NodeController(_workerWrapper, _nodeConfigurationFake) { Request = new HttpRequestMessage() }; _nodeController.PrepareToStartJob(_jobQueueItemEntity); var actionResult = _nodeController.StartJob(_jobQueueItemEntity.JobId); Assert.IsTrue(actionResult.ExecuteAsync(new CancellationToken()) .Result.StatusCode == HttpStatusCode.OK); }
public void CancelJobShouldReturnOkWhenSuccessful() { _workerWrapper = new WorkerWrapper(new LongRunningInvokeHandlerFake(), _nodeConfigurationFake, _nodeStartupNotification, _pingToManagerFake, _sendJobDoneTimer, _sendJobCanceledTimer, _sendJobFaultedTimer, _trySendJobDetailToManagerTimerFake); _nodeController = new NodeController(_workerWrapper, _nodeConfigurationFake) { Request = new HttpRequestMessage() }; _nodeController.PrepareToStartJob(_jobQueueItemEntity); _nodeController.StartJob(_jobQueueItemEntity.JobId); //is this to make sure the job has started before cancelling? _trySendJobDetailToManagerTimerFake.WaitHandle.Wait(500); var actionResult = _nodeController.TryCancelJob(_jobQueueItemEntity.JobId); Assert.IsTrue(actionResult.ExecuteAsync(new CancellationToken()) .Result.StatusCode == HttpStatusCode.OK); }