Refactor tests to use async/await and improve naming
Updated all test methods to use asynchronous programming with `async` and `await`, replacing synchronous calls with `.GetAwaiter().GetResult()`. This improves readability and aligns with modern C# practices. Renamed test methods to reflect their asynchronous nature and better describe their behavior. Updated exception handling to validate HTTP methods and request URIs while maintaining original assertions. Applied changes consistently across multiple test classes, including `CommonApiTests`, `EndpointAuthApiTests`, `EndpointParamsApiTests`, `EndpointsApiTests`, `ProfileApiTests`, `RecActionApiTests`, and `ResultApiTests`.
This commit is contained in:
@@ -51,7 +51,7 @@ public class CommonApiTests : RecClientTestBase
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpdateAsync_with_body_payload_throws_or_completes()
|
||||
public async Task UpdateAsync_with_body_payload_throws_or_completes()
|
||||
{
|
||||
var (client, scope) = CreateScopedClient();
|
||||
using var _ = scope;
|
||||
@@ -64,7 +64,7 @@ public class CommonApiTests : RecClientTestBase
|
||||
|
||||
try
|
||||
{
|
||||
client.Common.UpdateAsync(payload).GetAwaiter().GetResult();
|
||||
await client.Common.UpdateAsync(payload);
|
||||
Assert.Pass("Update completed.");
|
||||
}
|
||||
catch (ReCApiException ex)
|
||||
@@ -75,7 +75,7 @@ public class CommonApiTests : RecClientTestBase
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeleteAsync_sends_payload_as_query_string()
|
||||
public async Task DeleteAsync_sends_payload_as_query_string()
|
||||
{
|
||||
var (client, scope) = CreateScopedClient();
|
||||
using var _ = scope;
|
||||
@@ -90,7 +90,7 @@ public class CommonApiTests : RecClientTestBase
|
||||
|
||||
try
|
||||
{
|
||||
client.Common.DeleteAsync(payload).GetAwaiter().GetResult();
|
||||
await client.Common.DeleteAsync(payload);
|
||||
}
|
||||
catch (ReCApiException ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user