File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
test/Libraries/Microsoft.Extensions.AI.Integration.Tests Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -43,13 +43,23 @@ public virtual async Task GenerateImagesAsync_SingleImageGeneration()
4343
4444 Assert . NotNull ( response ) ;
4545 Assert . NotEmpty ( response . Contents ) ;
46- Assert . Single ( response . Contents ) ;
4746
48- var content = response . Contents [ 0 ] ;
49- Assert . IsType < DataContent > ( content ) ;
50- var dataContent = ( DataContent ) content ;
51- Assert . False ( dataContent . Data . IsEmpty ) ;
52- Assert . StartsWith ( "image/" , dataContent . MediaType , StringComparison . Ordinal ) ;
47+ var content = Assert . Single ( response . Contents ) ;
48+ switch ( content )
49+ {
50+ case UriContent uc :
51+ Assert . StartsWith ( "http" , uc . Uri . Scheme , StringComparison . Ordinal ) ;
52+ break ;
53+
54+ case DataContent dc :
55+ Assert . False ( dc . Data . IsEmpty ) ;
56+ Assert . StartsWith ( "image/" , dc . MediaType , StringComparison . Ordinal ) ;
57+ break ;
58+
59+ default :
60+ Assert . Fail ( $ "Unexpected content type: { content . GetType ( ) } ") ;
61+ break ;
62+ }
5363 }
5464
5565 [ ConditionalFact ]
You can’t perform that action at this time.
0 commit comments