public void ReportStatus_ShallReportFailureWithRetry() { var task = new TaskResponse { TaskId = Guid.NewGuid(), Uris = new[] { "file1", "file2", "file3" } }; _config.AeTitle = "AET"; _config.HostIp = "IP"; _config.Port = 1000; var job = new OutputJob(task, _logger.Object, _resultsService.Object, _config); job.ReportStatus(_cancellationTokenSource.Token); _resultsService.Verify(p => p.ReportFailure(task.TaskId, true, _cancellationTokenSource.Token), Times.Once()); _resultsService.Verify(p => p.ReportSuccess(It.IsAny <Guid>(), It.IsAny <CancellationToken>()), Times.Never()); _logger.VerifyLoggingMessageBeginsWith($"Task marked as failed with failure rate", LogLevel.Information, Times.Once()); }
public void ReportStatus_ShallReportSuccess() { var task = new TaskResponse { TaskId = Guid.NewGuid(), Uris = new[] { "file1", "file2", "file3" }, Retries = 3 }; _config.AeTitle = "AET"; _config.HostIp = "IP"; _config.Port = 1000; var job = new OutputJob(task, _logger.Object, _resultsService.Object, _config); job.ProcessedDicomFiles.Add(new DicomFile()); job.ProcessedDicomFiles.Add(new DicomFile()); job.ReportStatus(_cancellationTokenSource.Token); _resultsService.Verify(p => p.ReportFailure(It.IsAny <Guid>(), It.IsAny <bool>(), It.IsAny <CancellationToken>()), Times.Never()); _resultsService.Verify(p => p.ReportSuccess(task.TaskId, _cancellationTokenSource.Token), Times.Once()); _logger.VerifyLogging($"Task marked as successful", LogLevel.Information, Times.Once()); }