예제 #1
0
        public async Task GivenAFhirMediator_WhenCancelingExistingExportJobThatHasNotCompleted_ThenAcceptedStatusCodeShouldBeReturned(OperationStatus operationStatus)
        {
            ExportJobOutcome outcome = null;

            var instant = new DateTimeOffset(2019, 5, 3, 22, 45, 15, TimeSpan.FromMinutes(-60));

            using (Mock.Property(() => ClockResolver.UtcNowFunc, () => instant))
            {
                outcome = await SetupAndExecuteCancelExportAsync(operationStatus, HttpStatusCode.Accepted);
            }

            // Check to make sure the record is updated
            Assert.Equal(OperationStatus.Canceled, outcome.JobRecord.Status);
            Assert.Equal(instant, outcome.JobRecord.CanceledTime);

            await _fhirOperationDataStore.Received(1).UpdateExportJobAsync(outcome.JobRecord, outcome.ETag, _cancellationToken);
        }