diff --git a/test/Worker.Extensions.DurableTask.Tests/FunctionsDurableTaskClientTests.cs b/test/Worker.Extensions.DurableTask.Tests/FunctionsDurableTaskClientTests.cs index 3d25cae1b..1623f4559 100644 --- a/test/Worker.Extensions.DurableTask.Tests/FunctionsDurableTaskClientTests.cs +++ b/test/Worker.Extensions.DurableTask.Tests/FunctionsDurableTaskClientTests.cs @@ -155,8 +155,11 @@ public async Task TestWaitForCompletionOrCreateCheckStatusResponseAsync_WhenRunn var client = this.GetTestFunctionsDurableTaskClient(orchestrationMetadata: expectedResult); HttpRequestData request = this.MockHttpRequestAndResponseData(); - CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); - HttpResponseData response = await client.WaitForCompletionOrCreateCheckStatusResponseAsync(request, instanceId, cancellation : cts.Token); + HttpResponseData response; + using (CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromSeconds(10))) + { + response = await client.WaitForCompletionOrCreateCheckStatusResponseAsync(request, instanceId, cancellation: cts.Token); + }; Assert.NotNull(response); Assert.Equal(HttpStatusCode.Accepted, response.StatusCode);