1010using System . Net . Http ;
1111using CloudConvert . API . Models . TaskOperations ;
1212using System . Collections . Generic ;
13+ using System . Dynamic ;
14+ using System . Text . Json ;
1315
1416namespace CloudConvert . Test
1517{
@@ -85,7 +87,7 @@ public async Task CreateJob(string streamingMethod)
8587 await File . WriteAllBytesAsync ( fileExport . Filename , fileBytes ) ;
8688 }
8789
88-
90+
8991 [ Test ]
9092 public async Task CreateJobWithOptions ( )
9193 {
@@ -96,15 +98,15 @@ public async Task CreateJobWithOptions()
9698 import_it = new ImportUploadCreateRequest ( ) ,
9799 convert_it = new ConvertCreateRequest
98100 {
99- Input = "import_it" ,
101+ Input = "import_it" ,
100102 Input_Format = "pdf" ,
101103 Output_Format = "jpg" ,
102104 Options = new Dictionary < string , object > {
103- { "width" , 800 } ,
104- { "height" , 600 } ,
105- { "fit" , "max" }
106- }
105+ { "width" , 800 } ,
106+ { "height" , 600 } ,
107+ { "fit" , "max" }
107108 }
109+ }
108110 } ,
109111 Tag = "integration-test-convert-with-options"
110112 } ) ;
@@ -120,11 +122,11 @@ public async Task CreateJobWithOptions()
120122 // get created convert task
121123
122124 var convertTask = await _cloudConvertAPI . GetTaskAsync ( job . Data . Tasks . FirstOrDefault ( t => t . Name == "convert_it" ) . Id , "payload" ) ;
123- var payload = ( ( Newtonsoft . Json . Linq . JObject ) convertTask . Data . Payload ) . ToObject < Dictionary < string , object > > ( ) ;
125+ dynamic payload = JsonSerializer . Deserialize < ExpandoObject > ( convertTask . Data . Payload . ToString ( ) ) ;
124126 Assert . IsNotNull ( payload ) ;
125- Assert . AreEqual ( 800 , payload [ " width" ] ) ;
126- Assert . AreEqual ( 600 , payload [ " height" ] ) ;
127- Assert . AreEqual ( "max" , payload [ " fit" ] ) ;
127+ Assert . AreEqual ( 800 , ( ( JsonElement ) payload . width ) . GetInt32 ( ) ) ;
128+ Assert . AreEqual ( 600 , ( ( JsonElement ) payload . height ) . GetInt32 ( ) ) ;
129+ Assert . AreEqual ( "max" , ( ( JsonElement ) payload . fit ) . GetString ( ) ) ;
128130
129131 }
130132
0 commit comments