diff --git a/tests/SwaggerProvider.Tests/RuntimeHelpersTests.fs b/tests/SwaggerProvider.Tests/RuntimeHelpersTests.fs index a290eddc..378f43fa 100644 --- a/tests/SwaggerProvider.Tests/RuntimeHelpersTests.fs +++ b/tests/SwaggerProvider.Tests/RuntimeHelpersTests.fs @@ -170,6 +170,42 @@ module ToQueryParamsTests = let result = toQueryParams "id" (box [| g1; g2 |]) stubClient result |> shouldEqual [ ("id", g1.ToString()); ("id", g2.ToString()) ] + [] + let ``toQueryParams handles float32 array``() = + let result = toQueryParams "v" (box [| 1.5f; 2.5f |]) stubClient + result |> shouldEqual [ ("v", "1.5"); ("v", "2.5") ] + + [] + let ``toQueryParams handles double array``() = + let result = toQueryParams "v" (box [| 1.5; 2.5 |]) stubClient + result |> shouldEqual [ ("v", "1.5"); ("v", "2.5") ] + + [] + let ``toQueryParams handles byte array as base64``() = + // byte[] is serialized via client.Serialize (JSON base64) with surrounding quotes trimmed + let bytes = [| 72uy; 101uy; 108uy; 108uy; 111uy |] // "Hello" in ASCII + let expected = (JsonSerializer.Serialize bytes).Trim('"') + let result = toQueryParams "data" (box bytes) stubClient + result |> shouldEqual [ ("data", expected) ] + + [] + let ``toQueryParams skips None items in Option array``() = + let values: Option[] = [| Some "a"; None; Some "c" |] + let result = toQueryParams "q" (box values) stubClient + result |> shouldEqual [ ("q", "a"); ("q", "c") ] + + [] + let ``toQueryParams skips None items in Option array``() = + let values: Option[] = [| Some 1.5f; None; Some 3.5f |] + let result = toQueryParams "v" (box values) stubClient + result |> shouldEqual [ ("v", "1.5"); ("v", "3.5") ] + + [] + let ``toQueryParams skips None items in Option array``() = + let values: Option[] = [| Some 1.5; None; Some 3.5 |] + let result = toQueryParams "v" (box values) stubClient + result |> shouldEqual [ ("v", "1.5"); ("v", "3.5") ] + module CombineUrlTests =