public void TextureInfoTestError() { var model = new glTFMaterialBaseColorTextureInfo(); var c = new JsonSchemaValidationContext("") { EnableDiagnosisForNotRequiredFields = true, }; var ex = Assert.Throws <JsonSchemaValidationException>( () => JsonSchema.FromType <glTFMaterialBaseColorTextureInfo>().Serialize(model, c) ); Assert.AreEqual("[index.String] minimum: ! -1>=0", ex.Message); }
public void TextureInfoTest() { var model = new glTFMaterialBaseColorTextureInfo() { index = 1, }; var json = model.ToJson(); Assert.AreEqual(@"{""index"":1,""texCoord"":0}", json); Debug.Log(json); var c = new JsonSchemaValidationContext("") { EnableDiagnosisForNotRequiredFields = true, }; var json2 = JsonSchema.FromType <glTFMaterialBaseColorTextureInfo>().Serialize(model, c); Assert.AreEqual(json, json2); }