From 965bbdadbc5db72ea92debb059f890adb531e68a Mon Sep 17 00:00:00 2001 From: Demis Bellot Date: Mon, 25 Nov 2024 17:28:26 +0800 Subject: [PATCH] Replace all invalid PostAsync with Get DTOs to use Send which infers method to use --- AiServer.Tests/QueueImageServiceTests.cs | 12 ++++++------ AiServer.Tests/QueueImageToImageTests.cs | 4 ++-- AiServer.Tests/QueueImageToTextTests.cs | 4 ++-- AiServer.Tests/QueueImageUpscaleTests.cs | 4 ++-- AiServer.Tests/QueueImageWithMaskTests.cs | 4 ++-- AiServer.Tests/QueueSpeechToTextTests.cs | 6 +++--- AiServer.Tests/QueueTextToImageTests.cs | 4 ++-- AiServer.Tests/QueueTextToSpeechTests.cs | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/AiServer.Tests/QueueImageServiceTests.cs b/AiServer.Tests/QueueImageServiceTests.cs index 58cf1dd..92cf5f9 100644 --- a/AiServer.Tests/QueueImageServiceTests.cs +++ b/AiServer.Tests/QueueImageServiceTests.cs @@ -45,7 +45,7 @@ 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 }); @@ -53,7 +53,7 @@ public async Task Can_convert_image_to_png() 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 }); @@ -103,7 +103,7 @@ 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 }); @@ -111,7 +111,7 @@ public async Task Can_convert_image_to_jpeg() 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 }); @@ -212,7 +212,7 @@ 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 }); @@ -220,7 +220,7 @@ public async Task Can_crop_image() 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 }); diff --git a/AiServer.Tests/QueueImageToImageTests.cs b/AiServer.Tests/QueueImageToImageTests.cs index bb4f4ea..7bb75d8 100644 --- a/AiServer.Tests/QueueImageToImageTests.cs +++ b/AiServer.Tests/QueueImageToImageTests.cs @@ -134,7 +134,7 @@ 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 }); @@ -142,7 +142,7 @@ public async Task Can_generate_image_without_sync_or_reply_to() 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 }); diff --git a/AiServer.Tests/QueueImageToTextTests.cs b/AiServer.Tests/QueueImageToTextTests.cs index 2b4d7ac..368e8e1 100644 --- a/AiServer.Tests/QueueImageToTextTests.cs +++ b/AiServer.Tests/QueueImageToTextTests.cs @@ -128,7 +128,7 @@ 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 }); @@ -136,7 +136,7 @@ public async Task Can_convert_image_to_text_without_sync_or_reply_to() 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 }); diff --git a/AiServer.Tests/QueueImageUpscaleTests.cs b/AiServer.Tests/QueueImageUpscaleTests.cs index d486469..325e0c7 100644 --- a/AiServer.Tests/QueueImageUpscaleTests.cs +++ b/AiServer.Tests/QueueImageUpscaleTests.cs @@ -129,7 +129,7 @@ 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 }); @@ -137,7 +137,7 @@ public async Task Can_upscale_image_without_sync_or_reply_to() 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 }); diff --git a/AiServer.Tests/QueueImageWithMaskTests.cs b/AiServer.Tests/QueueImageWithMaskTests.cs index 7a4dd53..c5bef5c 100644 --- a/AiServer.Tests/QueueImageWithMaskTests.cs +++ b/AiServer.Tests/QueueImageWithMaskTests.cs @@ -146,7 +146,7 @@ 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 }); @@ -154,7 +154,7 @@ public async Task Can_generate_image_with_mask_without_sync_or_reply_to() 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 }); diff --git a/AiServer.Tests/QueueSpeechToTextTests.cs b/AiServer.Tests/QueueSpeechToTextTests.cs index c23fb93..a6eeb17 100644 --- a/AiServer.Tests/QueueSpeechToTextTests.cs +++ b/AiServer.Tests/QueueSpeechToTextTests.cs @@ -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 }); @@ -147,7 +147,7 @@ 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 }); @@ -155,7 +155,7 @@ public async Task Can_transcribe_speech_without_sync_or_reply_to() 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 }); diff --git a/AiServer.Tests/QueueTextToImageTests.cs b/AiServer.Tests/QueueTextToImageTests.cs index 6e154b6..81e3f99 100644 --- a/AiServer.Tests/QueueTextToImageTests.cs +++ b/AiServer.Tests/QueueTextToImageTests.cs @@ -161,7 +161,7 @@ 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 }); @@ -169,7 +169,7 @@ public async Task Can_generate_image_without_sync_or_reply_to() 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 }); diff --git a/AiServer.Tests/QueueTextToSpeechTests.cs b/AiServer.Tests/QueueTextToSpeechTests.cs index b7ea1b6..3178294 100644 --- a/AiServer.Tests/QueueTextToSpeechTests.cs +++ b/AiServer.Tests/QueueTextToSpeechTests.cs @@ -119,7 +119,7 @@ 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 }); @@ -127,7 +127,7 @@ public async Task Can_generate_speech_without_sync_or_reply_to() 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 });