@@ -25,7 +25,7 @@ public sealed class AzureOpenAITextToImageTests
2525 . Build ( ) ;
2626
2727 [ Fact ( Skip = "This test is for manual verification." ) ]
28- public async Task ItCanReturnImageUrlAsync ( )
28+ public async Task ItCanReturnImageContentAsync ( )
2929 {
3030 // Arrange
3131 AzureOpenAIConfiguration ? configuration = this . _configuration . GetSection ( "AzureOpenAITextToImage" ) . Get < AzureOpenAIConfiguration > ( ) ;
@@ -35,7 +35,8 @@ public async Task ItCanReturnImageUrlAsync()
3535 . AddAzureOpenAITextToImage (
3636 deploymentName : configuration . DeploymentName ,
3737 endpoint : configuration . Endpoint ,
38- credentials : new AzureCliCredential ( ) )
38+ credentials : new AzureCliCredential ( ) ,
39+ apiVersion : "2025-04-01-preview" )
3940 . Build ( ) ;
4041
4142 var service = kernel . GetRequiredService < ITextToImageService > ( ) ;
@@ -45,11 +46,11 @@ public async Task ItCanReturnImageUrlAsync()
4546
4647 // Assert
4748 Assert . NotNull ( result ) ;
48- Assert . StartsWith ( "https://" , result ) ;
49+ Assert . NotEmpty ( result ) ;
4950 }
5051
5152 [ Fact ]
52- public async Task GetImageContentsCanReturnImageUrlAsync ( )
53+ public async Task GetImageContentsCanReturnImageAsync ( )
5354 {
5455 // Arrange
5556 AzureOpenAIConfiguration ? configuration = this . _configuration . GetSection ( "AzureOpenAITextToImage" ) . Get < AzureOpenAIConfiguration > ( ) ;
@@ -59,7 +60,8 @@ public async Task GetImageContentsCanReturnImageUrlAsync()
5960 . AddAzureOpenAITextToImage (
6061 deploymentName : configuration . DeploymentName ,
6162 endpoint : configuration . Endpoint ,
62- credentials : new AzureCliCredential ( ) )
63+ credentials : new AzureCliCredential ( ) ,
64+ apiVersion : "2025-04-01-preview" )
6365 . Build ( ) ;
6466
6567 var service = kernel . GetRequiredService < ITextToImageService > ( ) ;
@@ -70,8 +72,8 @@ public async Task GetImageContentsCanReturnImageUrlAsync()
7072 // Assert
7173 Assert . NotNull ( result ) ;
7274 Assert . NotEmpty ( result ) ;
73- Assert . NotEmpty ( result [ 0 ] . Uri ! . ToString ( ) ) ;
74- Assert . StartsWith ( "https://" , result [ 0 ] . Uri ! . ToString ( ) ) ;
75+ var imageContent = result [ 0 ] ;
76+ Assert . True ( imageContent . Uri is not null || imageContent . Data is not null , "Image content should have either a URI or binary data." ) ;
7577 }
7678
7779 [ Fact ]
@@ -89,6 +91,7 @@ public async Task SemanticKernelVersionHeaderIsSentAsync()
8991 deploymentName : configuration . DeploymentName ,
9092 endpoint : configuration . Endpoint ,
9193 credentials : new AzureCliCredential ( ) ,
94+ apiVersion : "2025-04-01-preview" ,
9295 httpClient : httpClient )
9396 . Build ( ) ;
9497
@@ -100,8 +103,8 @@ public async Task SemanticKernelVersionHeaderIsSentAsync()
100103 // Assert
101104 Assert . NotNull ( result ) ;
102105 Assert . NotEmpty ( result ) ;
103- Assert . NotEmpty ( result [ 0 ] . Uri ! . ToString ( ) ) ;
104- Assert . StartsWith ( "https://" , result [ 0 ] . Uri ! . ToString ( ) ) ;
106+ var imageContent = result [ 0 ] ;
107+ Assert . True ( imageContent . Uri is not null || imageContent . Data is not null , "Image content should have either a URI or binary data." ) ;
105108 Assert . NotNull ( httpHeaderHandler . RequestHeaders ) ;
106109 Assert . True ( httpHeaderHandler . RequestHeaders . TryGetValues ( "Semantic-Kernel-Version" , out var values ) ) ;
107110 }
0 commit comments