1- using System . Diagnostics ;
21using ManagedCode . OpenAI . Client ;
3- using ManagedCode . OpenAI . Files . Abstractions ;
2+ using ManagedCode . OpenAI . Files ;
43using Xunit ;
54using Xunit . Abstractions ;
5+ using Xunit . Sdk ;
66
77namespace ManagedCode . OpenAI . Tests ;
88
99
1010
1111public class FileTest
1212{
13+ private const string SKIP = $ "Class { nameof ( FileTest ) } disabled";
14+
15+
1316 private readonly ITestOutputHelper _output ;
1417 private readonly IGptClient _client = Mocks . Client ( ) ;
15- private readonly IFileManager _fileManager ;
18+ private readonly IFileClient _fileClient ;
1619
1720
1821 private const string fileContent =
@@ -22,16 +25,16 @@ public class FileTest
2225 public FileTest ( ITestOutputHelper output )
2326 {
2427 _output = output ;
25- _fileManager = _client . FileManager ( ) ;
28+ _fileClient = _client . FileClient ;
2629 }
2730
28- [ Fact ]
31+ [ Fact ( Skip = SKIP ) ]
2932 public async Task UploadFile_Success ( )
3033 {
3134 const string fileName = "test.txt" ;
3235
3336
34- var file = await _fileManager . CreateFileAsync ( fileContent , fileName ) ;
37+ var file = await _fileClient . CreateFileAsync ( fileContent , fileName ) ;
3538
3639 Log ( $ "File id: { file . Id } ") ;
3740
@@ -40,30 +43,30 @@ public async Task UploadFile_Success()
4043 Assert . Equal ( fileContent . Length , file . Bytes ) ;
4144 }
4245
43-
46+
4447 // Needs premium account
45- // [Fact]
48+ [ Fact ( Skip = SKIP ) ]
4649 public async Task ContentFile_Success ( )
4750 {
48- string fileId = await _fileManager . FileListAsync ( )
51+ string fileId = await _fileClient . FileListAsync ( )
4952 . ContinueWith ( t => t . Result [ 0 ] . Id ) ;
5053
51- var content = await _fileManager . FileContentAsync ( fileId ) ;
54+ var content = await _fileClient . FileContentAsync ( fileId ) ;
5255
5356 Log ( $ "File content: { content } ") ;
5457
5558 Assert . Equal ( fileContent , content ) ;
5659 }
57-
58- [ Fact ]
60+
61+ [ Fact ( Skip = SKIP ) ]
5962 public async Task FileList_Success ( )
6063 {
6164 const string fileName = "test.txt" ;
6265
63- var newFile = await _fileManager . CreateFileAsync ( fileContent , fileName ) ;
66+ var newFile = await _fileClient . CreateFileAsync ( fileContent , fileName ) ;
6467 Assert . NotNull ( newFile ) ;
6568
66- var files = await _fileManager . FileListAsync ( ) ;
69+ var files = await _fileClient . FileListAsync ( ) ;
6770 Assert . NotEmpty ( files ) ;
6871
6972
@@ -78,35 +81,35 @@ public async Task FileList_Success()
7881 Assert . Equal ( newFile . Filename , lastFiles . Filename ) ;
7982 Assert . Equal ( newFile . Bytes , lastFiles . Bytes ) ;
8083 }
81-
82- [ Fact ]
84+
85+ [ Fact ( Skip = SKIP ) ]
8386 public async Task DeleteFile_Success ( )
8487 {
8588 const string fileName = "test.txt" ;
8689
87- var newFile = await _fileManager . CreateFileAsync ( fileContent , fileName ) ;
90+ var newFile = await _fileClient . CreateFileAsync ( fileContent , fileName ) ;
8891 Assert . NotNull ( newFile ) ;
8992
9093 //Waiting for file to be deleted
9194 Thread . Sleep ( 5000 ) ;
9295
93- var deleted = await _fileManager . DeleteFileAsync ( newFile ) ;
96+ var deleted = await _fileClient . DeleteFileAsync ( newFile ) ;
9497 Log ( deleted . ToString ( ) ) ;
9598 Assert . True ( deleted ) ;
9699
97- var files = await _fileManager . FileListAsync ( ) ;
100+ var files = await _fileClient . FileListAsync ( ) ;
98101 Assert . NotEqual ( newFile . Id , files . Last ( ) . Id ) ;
99102 }
100-
101- [ Fact ]
103+
104+ [ Fact ( Skip = SKIP ) ]
102105 public async Task FileInfo_Success ( )
103106 {
104107 const string fileName = "test.txt" ;
105108
106- var newFile = await _fileManager . CreateFileAsync ( fileContent , fileName ) ;
109+ var newFile = await _fileClient . CreateFileAsync ( fileContent , fileName ) ;
107110 Assert . NotNull ( newFile ) ;
108111
109- var fileInfo = await _fileManager . FileInfoAsync ( newFile . Id ) ;
112+ var fileInfo = await _fileClient . FileInfoAsync ( newFile . Id ) ;
110113 Assert . NotNull ( fileInfo ) ;
111114
112115 Assert . Equal ( newFile . Id , fileInfo . Id ) ;
0 commit comments