@@ -182,11 +182,6 @@ public class File : Content
182182 {
183183 public File ( IRestCaller restCaller , ILogger < Content > logger ) : base ( restCaller , logger ) { }
184184
185- /*TODO: Use enum VersioningMode
186- public enum VersioningType{Inherited, None, MajorOnly, MajorAndMinor}
187- public VersioningType VersioningMode { get; set; }
188- */
189- public string [ ] VersioningMode { get ; set ; }
190185 public string Version { get ; set ; }
191186 public Binary Binary { get ; set ; }
192187 }
@@ -311,29 +306,31 @@ await GetRepositoryCollection(
311306 var loadFileRequest = new LoadContentRequest
312307 {
313308 Path = filePath ,
314- Select = new [ ] { "Id" , "Path" , "Name" , "Type" , "Version" , "VersioningMode" , "Binary" }
309+ Select = new [ ] { "Id" , "Path" , "Name" , "Type" , "Version" , "VersioningMode" , "Binary" }
315310 } ;
316- var uploadRequest = new UploadRequest { ParentPath = rootPath , ContentName = fileName } ;
311+ var uploadRequest = new UploadRequest { ParentPath = rootPath , ContentName = fileName } ;
317312
318313 // Prepare file versions
319314 var file = repository . CreateContent < File > ( rootPath , null , fileName ) ;
320- file . VersioningMode = new [ ] { "3" } ; // MajorAndMinor
315+ file . VersioningMode = VersioningMode . MajorAndMinor ;
321316 await file . SaveAsync ( cancel ) . ConfigureAwait ( false ) ;
322317
323318 await file . CheckOutAsync ( cancel ) . ConfigureAwait ( false ) ; // V0.2.L
324319
325320 await using ( var uploadStream = Tools . GenerateStreamFromString ( "File text 1" ) )
326- uploadedResult = await repository . UploadAsync ( uploadRequest , uploadStream , cancel ) . ConfigureAwait ( false ) ;
321+ uploadedResult =
322+ await repository . UploadAsync ( uploadRequest , uploadStream , cancel ) . ConfigureAwait ( false ) ;
327323
328324 await file . CheckInAsync ( cancel ) . ConfigureAwait ( false ) ; //V0.2.D
329325
330326 await file . CheckOutAsync ( cancel ) . ConfigureAwait ( false ) ; // V0.3.L
331327
332328 await using ( var uploadStream = Tools . GenerateStreamFromString ( "File text 2" ) )
333- uploadedResult = await repository . UploadAsync ( uploadRequest , uploadStream , cancel ) . ConfigureAwait ( false ) ;
329+ uploadedResult =
330+ await repository . UploadAsync ( uploadRequest , uploadStream , cancel ) . ConfigureAwait ( false ) ;
334331
335332 await repository . GetResponseStringAsync (
336- new ODataRequest ( repository . Server ) { ContentId = file . Id , ActionName = "Publish" } , // V1.0.A
333+ new ODataRequest ( repository . Server ) { ContentId = file . Id , ActionName = "Publish" } , // V1.0.A
337334 HttpMethod . Post , cancel ) . ConfigureAwait ( false ) ;
338335
339336 Assert . AreEqual ( file . Id , uploadedResult . Id ) ;
@@ -343,7 +340,8 @@ await repository.GetResponseStringAsync(
343340 await file . CheckOutAsync ( cancel ) . ConfigureAwait ( false ) ; // V1.1.L
344341
345342 await using ( var uploadStream = Tools . GenerateStreamFromString ( "File text 3" ) )
346- uploadedResult = await repository . UploadAsync ( uploadRequest , uploadStream , cancel ) . ConfigureAwait ( false ) ;
343+ uploadedResult =
344+ await repository . UploadAsync ( uploadRequest , uploadStream , cancel ) . ConfigureAwait ( false ) ;
347345
348346 await file . CheckInAsync ( cancel ) . ConfigureAwait ( false ) ; //V1.1.D
349347
@@ -352,21 +350,21 @@ await repository.GetResponseStringAsync(
352350 string ? lastMajorText = null ; // V1.0
353351 string ? file_V0_2Text = null ; // V0.2
354352 await repository . DownloadAsync (
355- request : new DownloadRequest { ContentId = file . Id } ,
353+ request : new DownloadRequest { ContentId = file . Id } ,
356354 responseProcessor : async ( stream , _ ) =>
357355 {
358356 using var reader = new StreamReader ( stream ) ;
359357 lastDraftText = await reader . ReadToEndAsync ( ) ;
360358 } , cancel ) . ConfigureAwait ( false ) ;
361359 await repository . DownloadAsync (
362- request : new DownloadRequest { ContentId = file . Id , Version = "LastMajor" } ,
360+ request : new DownloadRequest { ContentId = file . Id , Version = "LastMajor" } ,
363361 responseProcessor : async ( stream , _ ) =>
364362 {
365363 using var reader = new StreamReader ( stream ) ;
366364 lastMajorText = await reader . ReadToEndAsync ( ) ;
367365 } , cancel ) . ConfigureAwait ( false ) ;
368366 await repository . DownloadAsync (
369- request : new DownloadRequest { ContentId = file . Id , Version = "V0.2" } ,
367+ request : new DownloadRequest { ContentId = file . Id , Version = "V0.2" } ,
370368 responseProcessor : async ( stream , _ ) =>
371369 {
372370 using var reader = new StreamReader ( stream ) ;
@@ -378,6 +376,10 @@ await repository.DownloadAsync(
378376 Assert . AreEqual ( "File text 2" , lastMajorText ) ;
379377 Assert . AreEqual ( "File text 1" , file_V0_2Text ) ;
380378 }
379+ catch ( Exception e )
380+ {
381+ var q = 1 ;
382+ }
381383 finally
382384 {
383385 await repository . DeleteContentAsync ( filePath , true , cancel ) ;
0 commit comments