@@ -44,7 +44,7 @@ public async Task ValidateFileUrlAsync(string fileSource, string mediaType, bool
4444 public async Task ValidateImageFileDataAsync ( string fileSource , string mediaType , bool useConversation )
4545 {
4646 // Arrange
47- byte [ ] fileData = await File . ReadAllBytesAsync ( fileSource ) ;
47+ byte [ ] fileData = await ReadLocalFileAsync ( fileSource ) ;
4848 string encodedData = Convert . ToBase64String ( fileData ) ;
4949 string fileUrl = $ "data:{ mediaType } ;base64,{ encodedData } ";
5050 this . Output . WriteLine ( $ "Content: { fileUrl . Substring ( 0 , Math . Min ( 112 , fileUrl . Length ) ) } ...") ;
@@ -59,7 +59,7 @@ public async Task ValidateImageFileDataAsync(string fileSource, string mediaType
5959 public async Task ValidateFileDataAsync ( string fileSource , string mediaType , bool useConversation )
6060 {
6161 // Arrange
62- byte [ ] fileData = await File . ReadAllBytesAsync ( fileSource ) ;
62+ byte [ ] fileData = await ReadLocalFileAsync ( fileSource ) ;
6363 string encodedData = Convert . ToBase64String ( fileData ) ;
6464 string fileUrl = $ "data:{ mediaType } ;base64,{ encodedData } ";
6565 this . Output . WriteLine ( $ "Content: { fileUrl . Substring ( 0 , Math . Min ( 112 , fileUrl . Length ) ) } ...") ;
@@ -76,7 +76,7 @@ public async Task ValidateFileDataAsync(string fileSource, string mediaType, boo
7676 public async Task ValidateFileUploadAsync ( string fileSource , string documentName , bool useConversation )
7777 {
7878 // Arrange
79- byte [ ] fileData = await File . ReadAllBytesAsync ( fileSource ) ;
79+ byte [ ] fileData = await ReadLocalFileAsync ( fileSource ) ;
8080 AIProjectClient client = new ( this . TestEndpoint , new AzureCliCredential ( ) ) ;
8181 using MemoryStream contentStream = new ( fileData ) ;
8282 OpenAIFileClient fileClient = client . GetProjectOpenAIClient ( ) . GetOpenAIFileClient ( ) ;
@@ -94,6 +94,12 @@ public async Task ValidateFileUploadAsync(string fileSource, string documentName
9494 }
9595 }
9696
97+ private static Task < byte [ ] > ReadLocalFileAsync ( string relativePath )
98+ {
99+ string fullPath = Path . Combine ( AppContext . BaseDirectory , relativePath ) ;
100+ return Task . FromResult ( File . ReadAllBytes ( fullPath ) ) ;
101+ }
102+
97103 private async Task ValidateFileAsync ( AIContent fileContent , bool useConversation )
98104 {
99105 // Act
0 commit comments