Skip to content

Commit 0a5d2c5

Browse files
committed
Remove redundant ApiResponse.TranslateAsync calls
1 parent 4869615 commit 0a5d2c5

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

Diff for: test/OpenApiNSwagEndToEndTests/Headers/ETagTests.cs

+5-6
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
4242
var apiClient = new HeadersClient(httpClient);
4343

4444
// Act
45-
ApiResponse response = await ApiResponse.TranslateAsync(async () => await apiClient.HeadCountryCollectionAsync());
45+
ApiResponse response = await apiClient.HeadCountryCollectionAsync();
4646

4747
// Assert
4848
response.StatusCode.Should().Be((int)HttpStatusCode.OK);
@@ -69,7 +69,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
6969
var apiClient = new HeadersClient(httpClient);
7070

7171
// Act
72-
ApiResponse<CountryCollectionResponseDocument?> response = await ApiResponse.TranslateAsync(async () => await apiClient.GetCountryCollectionAsync());
72+
ApiResponse<CountryCollectionResponseDocument> response = await apiClient.GetCountryCollectionAsync();
7373

7474
// Assert
7575
response.StatusCode.Should().Be((int)HttpStatusCode.OK);
@@ -91,7 +91,7 @@ public async Task Returns_no_ETag_for_failed_GET_request()
9191
var apiClient = new HeadersClient(httpClient);
9292

9393
// Act
94-
Func<Task> action = async () => await ApiResponse.TranslateAsync(async () => await apiClient.GetCountryAsync(unknownCountryId));
94+
Func<Task> action = async () => await apiClient.GetCountryAsync(unknownCountryId);
9595

9696
// Assert
9797
ApiException<ErrorResponseDocument> exception = (await action.Should().ThrowExactlyAsync<ApiException<ErrorResponseDocument>>()).Which;
@@ -154,7 +154,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
154154
using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler);
155155
var apiClient = new HeadersClient(httpClient);
156156

157-
ApiResponse<CountryCollectionResponseDocument?> response1 = await ApiResponse.TranslateAsync(async () => await apiClient.GetCountryCollectionAsync());
157+
ApiResponse<CountryCollectionResponseDocument> response1 = await apiClient.GetCountryCollectionAsync();
158158

159159
string responseETag = response1.Headers[HeaderNames.ETag].Single();
160160

@@ -189,8 +189,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
189189
var apiClient = new HeadersClient(httpClient);
190190

191191
// Act
192-
ApiResponse<CountryCollectionResponseDocument?> response =
193-
await ApiResponse.TranslateAsync(async () => await apiClient.GetCountryCollectionAsync(null, "\"Not-a-matching-value\""));
192+
ApiResponse<CountryCollectionResponseDocument> response = await apiClient.GetCountryCollectionAsync(null, "\"Not-a-matching-value\"");
194193

195194
// Assert
196195
response.StatusCode.Should().Be((int)HttpStatusCode.OK);

Diff for: test/OpenApiNSwagEndToEndTests/Headers/HeaderTests.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
7676
var apiClient = new HeadersClient(httpClient);
7777

7878
// Act
79-
ApiResponse response = await ApiResponse.TranslateAsync(async () => await apiClient.HeadCountryCollectionAsync());
79+
ApiResponse response = await apiClient.HeadCountryCollectionAsync();
8080

8181
// Assert
8282
response.StatusCode.Should().Be((int)HttpStatusCode.OK);
@@ -102,7 +102,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
102102
var apiClient = new HeadersClient(httpClient);
103103

104104
// Act
105-
ApiResponse response = await ApiResponse.TranslateAsync(async () => await apiClient.HeadCountryAsync(existingCountry.Id));
105+
ApiResponse response = await apiClient.HeadCountryAsync(existingCountry.Id);
106106

107107
// Assert
108108
response.StatusCode.Should().Be((int)HttpStatusCode.OK);
@@ -129,7 +129,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
129129
var apiClient = new HeadersClient(httpClient);
130130

131131
// Act
132-
ApiResponse response = await ApiResponse.TranslateAsync(async () => await apiClient.HeadCountryLanguagesAsync(existingCountry.Id));
132+
ApiResponse response = await apiClient.HeadCountryLanguagesAsync(existingCountry.Id);
133133

134134
// Assert
135135
response.StatusCode.Should().Be((int)HttpStatusCode.OK);
@@ -156,7 +156,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
156156
var apiClient = new HeadersClient(httpClient);
157157

158158
// Act
159-
ApiResponse response = await ApiResponse.TranslateAsync(async () => await apiClient.HeadCountryLanguagesRelationshipAsync(existingCountry.Id));
159+
ApiResponse response = await apiClient.HeadCountryLanguagesRelationshipAsync(existingCountry.Id);
160160

161161
// Assert
162162
response.StatusCode.Should().Be((int)HttpStatusCode.OK);

0 commit comments

Comments
 (0)