public void ValidNumberTest(string file, JsonSpecData spec) { var json = TryParse(spec.Json); if (spec.Valid == true) { Assert.True(json.HasValue); } else if (spec.Valid == false) { Assert.False(json.HasValue); } }
public void ValidObjectTest(string file, JsonSpecData spec) { if (file.Contains("single_quote")) { return; } var json = TryParse(spec.Json); if (spec.Valid == true) { Assert.True(json.HasValue); } else if (spec.Valid == false) { Assert.False(json.HasValue); } }
public static IEnumerable <object[]> ReadFiles(string pattern) { string baseDir = Path.Combine(AppContext.BaseDirectory, "testsuites/JSONTestSuite/test_parsing"); foreach (string filePath in Directory.EnumerateFiles(baseDir, pattern)) { string filename = Path.GetFileName(filePath); string text = File.ReadAllText(filePath); var data = new JsonSpecData { Json = text, Path = filePath, FileName = filename, Valid = filename[0] == 'y' ? true : (filename[0] == 'n' ? false : default(bool?)), }; yield return(new object[] { filename, data }); } }