public async void CancelImports( [QueueTrigger("imports-cancelling")] CancelImportMessage message, ExecutionContext executionContext ) { var currentStatus = await _importStatusService.GetImportStatus(message.ReleaseId, message.DataFileName); await _importStatusService.UpdateStatus(message.ReleaseId, message.DataFileName, IStatus.CANCELLING, currentStatus.PercentageComplete); }
public void CancelImport() { var mocks = Mocks(); var(processorService, importStatusService, batchService, fileImportService) = mocks; var message = new CancelImportMessage { ReleaseId = Guid.NewGuid(), DataFileName = "my_data_file" }; var processor = new Processor.Functions.Processor( fileImportService.Object, batchService.Object, importStatusService.Object, processorService.Object, new Mock <ILogger <Processor.Functions.Processor> >().Object); var currentImportStatus = new ImportStatus { Status = IStatus.STAGE_4, PercentageComplete = 10, PhasePercentageComplete = 50, }; importStatusService .Setup(s => s.GetImportStatus(message.ReleaseId, message.DataFileName)) .ReturnsAsync(currentImportStatus); importStatusService .Setup(s => s.UpdateStatus(message.ReleaseId, message.DataFileName, IStatus.CANCELLING, currentImportStatus.PercentageComplete)) .Returns(Task.CompletedTask); processor.CancelImports( message, null); // Verify that the status has been updated to CANCELLING. MockUtils.VerifyAllMocks(processorService, importStatusService, batchService, fileImportService); }
public void CancelImport() { var mocks = Mocks(); var(processorService, importService, fileImportService) = mocks; var processor = new Processor.Functions.Processor( fileImportService.Object, importService.Object, processorService.Object, new Mock <ILogger <Processor.Functions.Processor> >().Object); var message = new CancelImportMessage(Guid.NewGuid()); importService .Setup(s => s.UpdateStatus(message.Id, CANCELLING, 0)) .Returns(Task.CompletedTask); processor.CancelImports(message); // Verify that the status has been updated to CANCELLING. MockUtils.VerifyAllMocks(processorService, importService, fileImportService); }
public async Task CancelImports([QueueTrigger(ImportsCancellingQueue)] CancelImportMessage message) { await _dataImportService.UpdateStatus(message.Id, DataImportStatus.CANCELLING, 0); }