-
-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathMain.fs
More file actions
52 lines (39 loc) · 1.36 KB
/
Copy pathMain.fs
File metadata and controls
52 lines (39 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
module Thoth.Json.Tests.System.Text.Json
open Thoth.Json.Tests.Testing
open Thoth.Json.System.Text.Json
open System.Text.Json
open System.Text.Json.Nodes
open Fable.Pyxpecto
open Thoth.Json.Tests
type SystemTextJsonEncode() =
interface IEncode with
override _.toString spaces json = Encode.toString spaces json
type SystemTextJsonEncodeDecode() =
interface IDecode<JsonElement> with
override _.fromValue decoder = Decode.fromValue decoder
override _.fromString decoder json = Decode.fromString decoder json
override _.unsafeFromString decoder json =
Decode.unsafeFromString decoder json
type SystemTextJsonTestRunner() =
inherit TestRunner<JsonElement, JsonNode>()
override _.Encode = SystemTextJsonEncode()
override _.Decode = SystemTextJsonEncodeDecode()
override _.EncoderHelpers = Encode.helpers
override _.DecoderHelpers = Decode.helpers
override _.MapEncoderValueToDecoderValue
(encoderValue: JsonNode)
: JsonElement
=
JsonSerializer.Deserialize<JsonElement>(encoderValue)
[<EntryPoint>]
let main args =
let runner = SystemTextJsonTestRunner()
testList
"All"
[
Decoders.tests runner
Encoders.tests runner
BackAndForth.tests runner
Syntax.tests runner
]
|> Pyxpecto.runTests [||]