1+ using System . IO ;
12using System . Threading . Tasks ;
23using Notion . Client ;
34using Xunit ;
@@ -38,24 +39,27 @@ public async Task Verify_file_upload_flow()
3839
3940 var createResponse = await Client . FileUploads . CreateAsync ( createRequest ) ;
4041
41- var sendRequest = SendFileUploadRequest . Create (
42- createResponse . Id ,
43- new FileData
44- {
45- FileName = "notion-logo.png" ,
46- Data = System . IO . File . OpenRead ( "assets/notion-logo.png" ) ,
47- ContentType = createResponse . ContentType
48- }
49- ) ;
42+ using ( var fileStream = File . OpenRead ( "assets/notion-logo.png" ) )
43+ {
44+ var sendRequest = SendFileUploadRequest . Create (
45+ createResponse . Id ,
46+ new FileData
47+ {
48+ FileName = "notion-logo.png" ,
49+ Data = fileStream ,
50+ ContentType = createResponse . ContentType
51+ }
52+ ) ;
5053
51- // Act
52- var sendResponse = await Client . FileUploads . SendAsync ( sendRequest ) ;
54+ // Act
55+ var sendResponse = await Client . FileUploads . SendAsync ( sendRequest ) ;
5356
54- // Assert
55- Assert . NotNull ( sendResponse ) ;
56- Assert . Equal ( createResponse . Id , sendResponse . Id ) ;
57- Assert . Equal ( "notion-logo.png" , sendResponse . FileName ) ;
58- Assert . Equal ( "uploaded" , sendResponse . Status ) ;
57+ // Assert
58+ Assert . NotNull ( sendResponse ) ;
59+ Assert . Equal ( createResponse . Id , sendResponse . Id ) ;
60+ Assert . Equal ( "notion-logo.png" , sendResponse . FileName ) ;
61+ Assert . Equal ( "uploaded" , sendResponse . Status ) ;
62+ }
5963 }
6064 }
6165}
0 commit comments