Files
WoofWare.Myriad/MyriadPlugin.Test/TestJsonParse/TestJsonParse.fs
2023-12-30 10:24:42 +00:00

35 lines
777 B
Forth

namespace MyriadPlugin.Test
open System.Text.Json.Nodes
open ConsumePlugin
open NUnit.Framework
open FsUnitTyped
[<TestFixture>]
module TestJsonParse =
[<Test>]
let ``Single example`` () =
let s =
"""
{
"a": 3, "another-thing": "hello", "hi": [6, 1], "d": {"something": "oh hi"},
"e": ["something", "else"], "f": []
}
"""
let expected =
{
A = 3
B = "hello"
C = [ 6 ; 1 ]
D =
{
Thing = "oh hi"
}
E = [| "something" ; "else" |]
F = [||]
}
let actual = s |> JsonNode.Parse |> JsonRecordType.jsonParse
actual |> shouldEqual expected