@@ -399,6 +399,54 @@ private static IEnumerable<object[]> BlockData()
399
399
. Subject . Should ( ) . BeOfType < RichTextText > ( )
400
400
. Subject . Text . Content . Should ( ) . Be ( "Data" ) ;
401
401
} )
402
+ } ,
403
+ new object [ ]
404
+ {
405
+ new FileBlockRequest {
406
+ File = new ExternalFile
407
+ {
408
+ Name = "Test file" ,
409
+ External = new ExternalFile . Info
410
+ {
411
+ Url = "https://www.iaspaper.net/wp-content/uploads/2017/09/TNEA-Online-Application.jpg"
412
+ } ,
413
+ Caption = new List < RichTextBase >
414
+ {
415
+ new RichTextTextInput { Text = new Text { Content = "Test file" } }
416
+ }
417
+ }
418
+ } ,
419
+ new FileUpdateBlock
420
+ {
421
+ File = new ExternalFileInput
422
+ {
423
+ Name = "Test file name" ,
424
+ External = new ExternalFileInput . Data
425
+ {
426
+ Url = "https://www.iaspaper.net/wp-content/uploads/2017/09/TNEA-Online-Application.jpg"
427
+ } ,
428
+ Caption = new List < RichTextBaseInput >
429
+ {
430
+ new RichTextTextInput { Text = new Text { Content = "Test file caption" } }
431
+ }
432
+ }
433
+ } ,
434
+ new Action < IBlock , INotionClient > ( ( block , client ) =>
435
+ {
436
+ var fileBlock = block . Should ( ) . NotBeNull ( ) . And . BeOfType < FileBlock > ( ) . Subject ;
437
+ fileBlock . HasChildren . Should ( ) . BeFalse ( ) ;
438
+
439
+ var file = fileBlock . File . Should ( ) . NotBeNull ( ) . And . BeOfType < ExternalFile > ( ) . Subject ;
440
+
441
+ // NOTE: The name of the file block, as shown in the Notion UI. Note that the UI may auto-append .pdf or other extensions.
442
+ file . Name . Should ( ) . Be ( "Test file name.jpg" ) ;
443
+
444
+ file . External . Should ( ) . NotBeNull ( ) ;
445
+ file . External . Url . Should ( ) . Be ( "https://www.iaspaper.net/wp-content/uploads/2017/09/TNEA-Online-Application.jpg" ) ;
446
+ file . Caption . Should ( ) . NotBeNull ( ) . And . ContainSingle ( )
447
+ . Subject . Should ( ) . BeOfType < RichTextText > ( ) . Subject
448
+ . Text . Content . Should ( ) . Be ( "Test file caption" ) ;
449
+ } )
402
450
}
403
451
} ;
404
452
}
0 commit comments