forked from fsprojects/FSharpx.Extras
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Corrected Outputting of date string"
This reverts commit 2e465a4.
- Loading branch information
Showing
3 changed files
with
36 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,34 @@ | ||
module FSharpx.Tests.JSON.SerializationTests | ||
|
||
open NUnit.Framework | ||
open FSharpx.JSON | ||
open FSharpx.JSON.DocumentExtensions | ||
open FsUnit | ||
|
||
[<Test>] | ||
let ``Can serialize empty document``() = | ||
JObject.New().ToString() | ||
|> should equal "{}" | ||
|
||
[<Test>] | ||
let ``Can serialize document with single property``() = | ||
JObject | ||
.New() | ||
.AddTextProperty("firstName","John") | ||
.ToString() | ||
|> should equal "{\"firstName\":\"John\"}" | ||
|
||
[<Test>] | ||
let ``Can serialize document with booleans``() = | ||
JObject | ||
.New() | ||
.AddBoolProperty("aa",true) | ||
.AddBoolProperty("bb",false) | ||
.ToString() | ||
|> should equal "{\"aa\":true,\"bb\":false}" | ||
|
||
[<Test>] | ||
let ``Can serialize document with array, null and number``() = | ||
let text = "{\"items\":[{\"id\":\"Open\"},null,{\"id\":25}]}" | ||
let json = parse text | ||
json.ToString() |> should equal text | ||
|
||
[<Test>] | ||
let ``Can serialise document with dates``() = | ||
JObject | ||
.New() | ||
.AddDateProperty("dd", new System.DateTime(1997, 2, 15, 0, 0, 0, System.DateTimeKind.Utc)) | ||
.ToString() | ||
|> should equal "{\"dd\":\"1997-02-15T00:00:00.0000000Z\"}" | ||
module FSharpx.Tests.JSON.SerializationTests | ||
|
||
open NUnit.Framework | ||
open FSharpx.JSON | ||
open FSharpx.JSON.DocumentExtensions | ||
open FsUnit | ||
|
||
[<Test>] | ||
let ``Can serialize empty document``() = | ||
JObject.New().ToString() | ||
|> should equal "{}" | ||
|
||
[<Test>] | ||
let ``Can serialize document with single property``() = | ||
JObject | ||
.New() | ||
.AddTextProperty("firstName","John") | ||
.ToString() | ||
|> should equal "{\"firstName\":\"John\"}" | ||
|
||
[<Test>] | ||
let ``Can serialize document with booleans``() = | ||
JObject | ||
.New() | ||
.AddBoolProperty("aa",true) | ||
.AddBoolProperty("bb",false) | ||
.ToString() | ||
|> should equal "{\"aa\":true,\"bb\":false}" | ||
|
||
[<Test>] | ||
let ``Can serialize document with array, null and number``() = | ||
let text = "{\"items\":[{\"id\":\"Open\"},null,{\"id\":25}]}" | ||
let json = parse text | ||
json.ToString() |> should equal text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters