public async Task Given_parent_job_is_queued_when_queueing_continuation_outside_of_correlation_context_should_use_same_correlation_id_as_parent() { const string correlationId = "my-id"; var expectedParentJob = new BackgroundTestExecutor { CorrelationId = correlationId, JobHasCompleted = true }; var expectedContinuationJob = new BackgroundTestExecutor { CorrelationId = correlationId, JobHasCompleted = true }; // Queue parent _correlationManager.Correlate(correlationId, () => { expectedParentJob.JobId = _client.Enqueue <BackgroundTestExecutor>( job => job.RunAsync(TimeoutInMillis, null) ); }); // Act // We queue on purpose outside of context, so we are able to test if the job inherits the correlation id from parent job. expectedContinuationJob.JobId = _client.ContinueJobWith <BackgroundTestExecutor>( expectedParentJob.JobId, job => job.RunAsync(TimeoutInMillis, null) ); await WaitUntilJobCompletedAsync(expectedContinuationJob.JobId); // Assert ExecutedJobs.Should().BeEquivalentTo( new List <object> { expectedParentJob, expectedContinuationJob }, "the continuation job should have the same correlation id" ); }