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.
Adding unit test which show that the number inference doesn't work as…
… expected. References issue fsprojects#176
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
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
25 changes: 25 additions & 0 deletions
25
tests/FSharpx.TypeProviders.Documents.Tests/InferenceTests.fs
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module FSharpx.TypeProviders.Tests.JSON.InferenceTests | ||
|
||
open NUnit.Framework | ||
open FSharpx | ||
open FsUnit | ||
|
||
type XmlCellSet = StructuredXml<Schema="""<CellSet><Row key="base64"><Cell timestamp="1349209076311" column="cGw6eG1s">base64</Cell></Row></CellSet>"""> | ||
|
||
type JsonCellSet = StructuredJSON<Schema="""{"Row":[{"key":"base64","Cell":[{"timestamp":1349209076311,"column":"cGw6eG1s","$":"base64"}]}]}"""> | ||
|
||
[<Test>] | ||
let ``Can infer the XML timestamp as integer``() = | ||
let inlined = XmlCellSet().Root | ||
for row in inlined.GetRows() do | ||
for cell in row.GetCells() do | ||
Assert.AreEqual(1349209076311L,cell.Timestamp) | ||
Assert.AreEqual(typeof<int64>,cell.Timestamp.GetType()) | ||
|
||
[<Test>] | ||
let ``Can infer the JSON timestamp as integer``() = | ||
let inlined = JsonCellSet().Root | ||
for row in inlined.GetRows() do | ||
for cell in row.GetCells() do | ||
Assert.AreEqual(1349209076311L,cell.Timestamp) | ||
Assert.AreEqual(typeof<int64>,cell.Timestamp.GetType()) |