Skip to content

Commit

Permalink
Replace all invalid PostAsync with Get DTOs to use Send which infers …
Browse files Browse the repository at this point in the history
…method to use
  • Loading branch information
mythz committed Nov 25, 2024
1 parent 4dce797 commit 965bbda
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
12 changes: 6 additions & 6 deletions AiServer.Tests/QueueImageServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ public async Task Can_convert_image_to_png()
Assert.That(response, Is.Not.Null);

// Verify that we can get the job status
var getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
var getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});

while (getStatusResponse.JobState is BackgroundJobState.Queued or BackgroundJobState.Started)
{
await Task.Delay(1000);
getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});
Expand Down Expand Up @@ -103,15 +103,15 @@ public async Task Can_convert_image_to_jpeg()
Assert.That(response, Is.Not.Null);

// Verify that we can get the job status
var getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
var getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});

while (getStatusResponse.JobState is BackgroundJobState.Queued or BackgroundJobState.Started)
{
await Task.Delay(1000);
getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});
Expand Down Expand Up @@ -212,15 +212,15 @@ public async Task Can_crop_image()
Assert.That(response, Is.Not.Null);

// Verify that we can get the job status
var getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
var getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});

while (getStatusResponse.JobState is BackgroundJobState.Queued or BackgroundJobState.Started)
{
await Task.Delay(1000);
getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});
Expand Down
4 changes: 2 additions & 2 deletions AiServer.Tests/QueueImageToImageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ public async Task Can_generate_image_without_sync_or_reply_to()
Assert.That(response.JobState is BackgroundJobState.Started or BackgroundJobState.Queued, Is.True);

// Verify that we can get the job status
var getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
var getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});

while (getStatusResponse.JobState == BackgroundJobState.Queued || getStatusResponse.JobState == BackgroundJobState.Started)
{
await Task.Delay(1000);
getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});
Expand Down
4 changes: 2 additions & 2 deletions AiServer.Tests/QueueImageToTextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ public async Task Can_convert_image_to_text_without_sync_or_reply_to()
Assert.That(response.JobState is BackgroundJobState.Started or BackgroundJobState.Queued, Is.True);

// Verify that we can get the job status
var getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
var getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});

while (getStatusResponse.JobState == BackgroundJobState.Queued || getStatusResponse.JobState == BackgroundJobState.Started)
{
await Task.Delay(1000);
getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});
Expand Down
4 changes: 2 additions & 2 deletions AiServer.Tests/QueueImageUpscaleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ public async Task Can_upscale_image_without_sync_or_reply_to()
Assert.That(response.JobState is BackgroundJobState.Started or BackgroundJobState.Queued, Is.True);

// Verify that we can get the job status
var getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
var getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});

while (getStatusResponse.JobState == BackgroundJobState.Queued || getStatusResponse.JobState == BackgroundJobState.Started)
{
await Task.Delay(1000);
getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});
Expand Down
4 changes: 2 additions & 2 deletions AiServer.Tests/QueueImageWithMaskTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ public async Task Can_generate_image_with_mask_without_sync_or_reply_to()
Assert.That(response.JobState is BackgroundJobState.Started or BackgroundJobState.Queued, Is.True);

// Verify that we can get the job status
var getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
var getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});

while (getStatusResponse.JobState == BackgroundJobState.Queued || getStatusResponse.JobState == BackgroundJobState.Started)
{
await Task.Delay(1000);
getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});
Expand Down
6 changes: 3 additions & 3 deletions AiServer.Tests/QueueSpeechToTextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public async Task Can_transcribe_speech_with_reply_to()
Assert.That(hasRepyTo.Succeeded, Is.True);

// Verify that we can get the job status
var getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
var getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});
Expand Down Expand Up @@ -147,15 +147,15 @@ public async Task Can_transcribe_speech_without_sync_or_reply_to()
Assert.True(response.JobState is BackgroundJobState.Queued or BackgroundJobState.Started);

// Verify that we can get the job status
var getStatusResponse = await client.PostAsync(new GetTextGenerationStatus
var getStatusResponse = await client.SendAsync(new GetTextGenerationStatus
{
JobId = response.JobId
});

while (getStatusResponse.JobState == BackgroundJobState.Queued || getStatusResponse.JobState == BackgroundJobState.Started)
{
await Task.Delay(1000);
getStatusResponse = await client.PostAsync(new GetTextGenerationStatus
getStatusResponse = await client.SendAsync(new GetTextGenerationStatus
{
JobId = response.JobId
});
Expand Down
4 changes: 2 additions & 2 deletions AiServer.Tests/QueueTextToImageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ public async Task Can_generate_image_without_sync_or_reply_to()
Assert.That(response.JobState is BackgroundJobState.Started or BackgroundJobState.Queued, Is.True);

// Verify that we can get the job status
var getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
var getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});

while (getStatusResponse.JobState == BackgroundJobState.Queued || getStatusResponse.JobState == BackgroundJobState.Started)
{
await Task.Delay(1000);
getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});
Expand Down
4 changes: 2 additions & 2 deletions AiServer.Tests/QueueTextToSpeechTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ public async Task Can_generate_speech_without_sync_or_reply_to()
Assert.True(response.JobState is BackgroundJobState.Queued or BackgroundJobState.Started or BackgroundJobState.Completed);

// Verify that we can get the job status
var getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
var getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});

while (getStatusResponse.JobState == BackgroundJobState.Queued || getStatusResponse.JobState == BackgroundJobState.Started)
{
await Task.Delay(1000);
getStatusResponse = await client.PostAsync(new GetArtifactGenerationStatus
getStatusResponse = await client.SendAsync(new GetArtifactGenerationStatus
{
JobId = response.JobId
});
Expand Down

0 comments on commit 965bbda

Please sign in to comment.