diff --git a/tests/FSharp.Data.Core.Tests/FSharp.Data.Core.Tests.fsproj b/tests/FSharp.Data.Core.Tests/FSharp.Data.Core.Tests.fsproj
index 94f0b2e9b..55f449f30 100644
--- a/tests/FSharp.Data.Core.Tests/FSharp.Data.Core.Tests.fsproj
+++ b/tests/FSharp.Data.Core.Tests/FSharp.Data.Core.Tests.fsproj
@@ -19,6 +19,7 @@
PreserveNewest
+
@@ -29,6 +30,7 @@
+
diff --git a/tests/FSharp.Data.Core.Tests/HttpContentTypes.fs b/tests/FSharp.Data.Core.Tests/HttpContentTypes.fs
new file mode 100644
index 000000000..17c5a47ac
--- /dev/null
+++ b/tests/FSharp.Data.Core.Tests/HttpContentTypes.fs
@@ -0,0 +1,73 @@
+module FSharp.Data.Tests.HttpContentTypes
+
+open NUnit.Framework
+open FsUnit
+open FSharp.Data
+
+[]
+let ``HttpContentTypes.Any should return correct MIME type`` () =
+ HttpContentTypes.Any |> should equal "*/*"
+
+[]
+let ``HttpContentTypes.Text should return correct MIME type`` () =
+ HttpContentTypes.Text |> should equal "text/plain"
+
+[]
+let ``HttpContentTypes.Binary should return correct MIME type`` () =
+ HttpContentTypes.Binary |> should equal "application/octet-stream"
+
+[]
+let ``HttpContentTypes.Zip should return correct MIME type`` () =
+ HttpContentTypes.Zip |> should equal "application/zip"
+
+[]
+let ``HttpContentTypes.GZip should return correct MIME type`` () =
+ HttpContentTypes.GZip |> should equal "application/gzip"
+
+[]
+let ``HttpContentTypes.FormValues should return correct MIME type`` () =
+ HttpContentTypes.FormValues |> should equal "application/x-www-form-urlencoded"
+
+[]
+let ``HttpContentTypes.Json should return correct MIME type`` () =
+ HttpContentTypes.Json |> should equal "application/json"
+
+[]
+let ``HttpContentTypes.JavaScript should return correct MIME type`` () =
+ HttpContentTypes.JavaScript |> should equal "application/javascript"
+
+[]
+let ``HttpContentTypes.Xml should return correct MIME type`` () =
+ HttpContentTypes.Xml |> should equal "application/xml"
+
+[]
+let ``HttpContentTypes.Rss should return correct MIME type`` () =
+ HttpContentTypes.Rss |> should equal "application/rss+xml"
+
+[]
+let ``HttpContentTypes.Atom should return correct MIME type`` () =
+ HttpContentTypes.Atom |> should equal "application/atom+xml"
+
+[]
+let ``HttpContentTypes.Rdf should return correct MIME type`` () =
+ HttpContentTypes.Rdf |> should equal "application/rdf+xml"
+
+[]
+let ``HttpContentTypes.Html should return correct MIME type`` () =
+ HttpContentTypes.Html |> should equal "text/html"
+
+[]
+let ``HttpContentTypes.XHtml should return correct MIME type`` () =
+ HttpContentTypes.XHtml |> should equal "application/xhtml+xml"
+
+[]
+let ``HttpContentTypes.Soap should return correct MIME type`` () =
+ HttpContentTypes.Soap |> should equal "application/soap+xml"
+
+[]
+let ``HttpContentTypes.Csv should return correct MIME type`` () =
+ HttpContentTypes.Csv |> should equal "text/csv"
+
+[]
+let ``HttpContentTypes.JsonRpc should return correct MIME type`` () =
+ HttpContentTypes.JsonRpc |> should equal "application/json-rpc"
\ No newline at end of file
diff --git a/tests/FSharp.Data.Core.Tests/JsonDocument.fs b/tests/FSharp.Data.Core.Tests/JsonDocument.fs
new file mode 100644
index 000000000..f68cbe09f
--- /dev/null
+++ b/tests/FSharp.Data.Core.Tests/JsonDocument.fs
@@ -0,0 +1,122 @@
+module FSharp.Data.Tests.JsonDocument
+
+open NUnit.Framework
+open FsUnit
+open FSharp.Data
+open FSharp.Data.Runtime.BaseTypes
+open System.IO
+open System.Reflection
+
+// Use reflection to access the "generated code only" methods for testing
+let private getCreateMethod() =
+ typeof.GetMethod("Create", [| typeof; typeof |])
+
+let private getCreateFromReaderMethod() =
+ typeof.GetMethod("Create", [| typeof |])
+
+let private getCreateListMethod() =
+ typeof.GetMethod("CreateList", [| typeof |])
+
+[]
+let ``JsonDocument.Create with JsonValue should return IJsonDocument using reflection`` () =
+ let createMethod = getCreateMethod()
+ let jsonValue = JsonValue.Number 42M
+ let doc = createMethod.Invoke(null, [| jsonValue; "/path" |]) :?> IJsonDocument
+
+ doc |> should not' (be null)
+ doc.JsonValue |> should equal jsonValue
+
+[]
+let ``JsonDocument.Create with TextReader should parse JSON using reflection`` () =
+ let createMethod = getCreateFromReaderMethod()
+ let json = """{"name": "test", "value": 123}"""
+ use reader = new StringReader(json)
+ let doc = createMethod.Invoke(null, [| reader |]) :?> IJsonDocument
+
+ doc |> should not' (be null)
+ doc.JsonValue |> should not' (be null)
+
+[]
+let ``JsonDocument.CreateList with single array should return array elements using reflection`` () =
+ let createListMethod = getCreateListMethod()
+ let json = """[{"id": 1}, {"id": 2}]"""
+ use reader = new StringReader(json)
+ let docs = createListMethod.Invoke(null, [| reader |]) :?> IJsonDocument[]
+
+ docs |> should haveLength 2
+ docs.[0].JsonValue.["id"].AsInteger() |> should equal 1
+ docs.[1].JsonValue.["id"].AsInteger() |> should equal 2
+
+[]
+let ``JsonDocument.CreateList with multiple JSON objects should return separate documents using reflection`` () =
+ let createListMethod = getCreateListMethod()
+ let json = """{"id": 1}{"id": 2}"""
+ use reader = new StringReader(json)
+ let docs = createListMethod.Invoke(null, [| reader |]) :?> IJsonDocument[]
+
+ docs |> should haveLength 2
+ docs.[0].JsonValue.["id"].AsInteger() |> should equal 1
+ docs.[1].JsonValue.["id"].AsInteger() |> should equal 2
+
+[]
+let ``JsonDocument ToString should return JsonValue string representation using reflection`` () =
+ let createMethod = getCreateMethod()
+ let jsonValue = JsonValue.Number 42M
+ let docObj = createMethod.Invoke(null, [| jsonValue; "/test" |])
+
+ docObj.ToString() |> should equal "42"
+
+[]
+let ``JsonDocument JsonValue property should return original JsonValue using reflection`` () =
+ let createMethod = getCreateMethod()
+ let jsonValue = JsonValue.String "test"
+ let doc = createMethod.Invoke(null, [| jsonValue; "/test" |]) :?> IJsonDocument
+
+ doc.JsonValue |> should equal jsonValue
+
+[]
+let ``IJsonDocument Path method should return path using reflection`` () =
+ let createMethod = getCreateMethod()
+ let jsonValue = JsonValue.Boolean true
+ let doc = createMethod.Invoke(null, [| jsonValue; "/root/item" |]) :?> IJsonDocument
+
+ // Use reflection to call the Path method to avoid the compiler message
+ let pathMethod = typeof.GetMethod("Path")
+ let path = pathMethod.Invoke(doc, [||]) :?> string
+
+ path |> should equal "/root/item"
+
+[]
+let ``IJsonDocument CreateNew should create new document with incremented path using reflection`` () =
+ let createMethod = getCreateMethod()
+ let jsonValue = JsonValue.Array [| JsonValue.Number 1M; JsonValue.Number 2M |]
+ let originalDoc = createMethod.Invoke(null, [| jsonValue; "/root" |]) :?> IJsonDocument
+ let newValue = JsonValue.Number 42M
+
+ // Use reflection to call CreateNew to avoid the compiler message
+ let createNewMethod = typeof.GetMethod("CreateNew")
+ let newDoc = createNewMethod.Invoke(originalDoc, [| newValue; "/item[0]" |]) :?> IJsonDocument
+
+ newDoc.JsonValue |> should equal newValue
+ let pathMethod = typeof.GetMethod("Path")
+ let path = pathMethod.Invoke(newDoc, [||]) :?> string
+ path |> should equal "/root/item[0]"
+
+[]
+let ``JsonDocument.Create with empty JSON should work using reflection`` () =
+ let createMethod = getCreateFromReaderMethod()
+ let json = "{}"
+ use reader = new StringReader(json)
+ let doc = createMethod.Invoke(null, [| reader |]) :?> IJsonDocument
+
+ doc |> should not' (be null)
+ doc.JsonValue |> should not' (be null)
+
+[]
+let ``JsonDocument.CreateList with empty array should return empty array using reflection`` () =
+ let createListMethod = getCreateListMethod()
+ let json = "[]"
+ use reader = new StringReader(json)
+ let docs = createListMethod.Invoke(null, [| reader |]) :?> IJsonDocument[]
+
+ docs |> should haveLength 0
\ No newline at end of file