@@ -484,3 +484,47 @@ let ``Should be able to upload files inside another input type``() =
484484 nullableMultipleNullable = Some ( Array.map ( Option.map makeUpload) request.NullableMultipleNullable.Value))
485485 UploadRequestOperation.operation.Run( input)
486486 |> UploadRequestOperation.validateResult request
487+
488+ module UploadComplexOperation =
489+ let operation =
490+ Provider.Operation< """ mutation UploadComplex($input: InputFile!) {
491+ uploadComplex(input: $input)
492+ }""" >()
493+
494+ type Operation = Provider.Operations.UploadComplex
495+ type InputFile = Provider.Types.InputFile
496+
497+ let validateResult ( file : File ) ( result : Operation.OperationResult ) =
498+ result |> checkRequestTypeHeader " Multipart"
499+ result.Data.IsSome |> equals true
500+ result.Data.Value.UploadComplex |> equals file.Content
501+
502+ [<Fact>]
503+ let ``Should be able to upload file using complex input object`` () =
504+ let file = { Name = " complex.txt" ; ContentType = " text/plain" ; Content = " Complex input object file content" }
505+ let input = UploadComplexOperation.InputFile( file = file.MakeUpload())
506+ UploadComplexOperation.operation.Run( input)
507+ |> UploadComplexOperation.validateResult file
508+
509+ [<Fact>]
510+ let ``Should be able to upload file using complex input object with context`` () =
511+ let file = { Name = " complex_context.txt" ; ContentType = " text/plain" ; Content = " Complex input with context file content" }
512+ let input = UploadComplexOperation.InputFile( file = file.MakeUpload())
513+ UploadComplexOperation.operation.Run( context, input)
514+ |> UploadComplexOperation.validateResult file
515+
516+ [<Fact>]
517+ let ``Should be able to upload file using complex input object asynchronously`` () : Task = task {
518+ let file = { Name = " complex_async.txt" ; ContentType = " text/plain" ; Content = " Complex input object async file content" }
519+ let input = UploadComplexOperation.InputFile( file = file.MakeUpload())
520+ let! result = UploadComplexOperation.operation.AsyncRun( input)
521+ result |> UploadComplexOperation.validateResult file
522+ }
523+
524+ [<Fact>]
525+ let ``Should be able to upload file using complex input object with context asynchronously`` () : Task = task {
526+ let file = { Name = " complex_context_async.txt" ; ContentType = " text/plain" ; Content = " Complex input with context async file content" }
527+ let input = UploadComplexOperation.InputFile( file = file.MakeUpload())
528+ let! result = UploadComplexOperation.operation.AsyncRun( context, input)
529+ result |> UploadComplexOperation.validateResult file
530+ }
0 commit comments