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:
@@ -57,7 +57,7 @@ public class ResultApiTests : RecClientTestBase
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateAsync_with_invalid_action_reference_throws_or_completes()
|
||||
public async Task CreateAsync_with_invalid_action_reference_throws_or_completes()
|
||||
{
|
||||
var (client, scope) = CreateScopedClient();
|
||||
using var _ = scope;
|
||||
@@ -73,7 +73,7 @@ public class ResultApiTests : RecClientTestBase
|
||||
|
||||
try
|
||||
{
|
||||
client.Results.CreateAsync(payload).GetAwaiter().GetResult();
|
||||
await client.Results.CreateAsync(payload);
|
||||
Assert.Pass("Create completed.");
|
||||
}
|
||||
catch (ReCApiException ex)
|
||||
@@ -84,7 +84,7 @@ public class ResultApiTests : RecClientTestBase
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpdateAsync_with_unknown_id_throws_or_completes()
|
||||
public async Task UpdateAsync_with_unknown_id_throws_or_completes()
|
||||
{
|
||||
var (client, scope) = CreateScopedClient();
|
||||
using var _ = scope;
|
||||
@@ -96,7 +96,7 @@ public class ResultApiTests : RecClientTestBase
|
||||
|
||||
try
|
||||
{
|
||||
client.Results.UpdateAsync(long.MaxValue, payload).GetAwaiter().GetResult();
|
||||
await client.Results.UpdateAsync(long.MaxValue, payload);
|
||||
Assert.Pass("Update completed.");
|
||||
}
|
||||
catch (ReCApiException ex)
|
||||
|
||||
Reference in New Issue
Block a user