Improve disposing.
MODIFY
WalletWasabi.Tests/RegressionTests/BackendTests.cs
WalletWasabi.Tests/RegressionTests/BackendTests.cs
@@ -90,7 +90,7 @@ namespace WalletWasabi.Tests.RegressionTests
Logger.TurnOff();
- var response = await BackendHttpClient.SendAsync(HttpMethod.Post, "btc/blockchain/broadcast", content);
+ using var response = await BackendHttpClient.SendAsync(HttpMethod.Post, "btc/blockchain/broadcast", content);
Assert.NotEqual(HttpStatusCode.OK, response.StatusCode);
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
@@ -191,7 +191,9 @@ namespace WalletWasabi.Tests.RegressionTests
times++;
}
- HttpResponseMessage? response = await BackendHttpClient.SendAsync(HttpMethod.Get, requestUri);
+ // First request.
+ {
+ using HttpResponseMessage? response = await BackendHttpClient.SendAsync(HttpMethod.Get, requestUri);
Assert.NotNull(response);
using (HttpContent content = response!.Content)
@@ -205,8 +207,11 @@ namespace WalletWasabi.Tests.RegressionTests
indexBuilderService = null;
await rpc.GenerateAsync(1);
+ }
- response = await BackendHttpClient.SendAsync(HttpMethod.Get, requestUri);
+ // Second request.
+ {
+ using HttpResponseMessage? response = await BackendHttpClient.SendAsync(HttpMethod.Get, requestUri);
Assert.NotNull(response);
using (HttpContent content = response!.Content)
@@ -222,12 +227,14 @@ namespace WalletWasabi.Tests.RegressionTests
// Set back the time to trigger timeout in BlockchainController.GetStatusAsync.
global.IndexBuilderService.LastFilterBuildTime = DateTimeOffset.UtcNow - BlockchainController.FilterTimeout;
+ }
- response = await BackendHttpClient.SendAsync(HttpMethod.Get, requestUri);
+ // Third request.
+ {
+ using HttpResponseMessage? response = await BackendHttpClient.SendAsync(HttpMethod.Get, requestUri);
Assert.NotNull(response);
- using (HttpContent content = response!.Content)
- {
+ using HttpContent content = response!.Content;
var resp = await content.ReadAsJsonAsync<StatusResponse>();
Assert.False(resp.FilterCreationActive);
}

Improve disposing.