Created
January 10, 2013 22:20
-
-
Save bradwilson/4506316 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| [Fact] | |
| public void Monkey() | |
| { | |
| string schema = | |
| @"{ | |
| ""id"": ""System.Version"", | |
| ""type"": ""object"", | |
| ""additionalProperties"": false, | |
| ""properties"": { | |
| ""Major"": { | |
| ""type"": ""integer"" | |
| }, | |
| ""Minor"": { | |
| ""type"": ""integer"" | |
| }, | |
| ""Build"": { | |
| ""type"": ""integer"" | |
| }, | |
| ""Revision"": { | |
| ""type"": ""integer"" | |
| }, | |
| ""MajorRevision"": { | |
| ""type"": ""integer"" | |
| }, | |
| ""MinorRevision"": { | |
| ""type"": ""integer"" | |
| } | |
| } | |
| }"; | |
| JsonSchema jschema = JsonSchema.Parse(schema); | |
| var jobj = JToken.Parse(@"{}"); | |
| IList<string> messages; | |
| bool result = jobj.IsValid(jschema, out messages); | |
| Assert.True(result); // messages is empty, result is true... counterintuitive? | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment