コード例 #1
0
ファイル: UniGLTFTests.cs プロジェクト: notargs/VCI
        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);
        }
コード例 #2
0
ファイル: UniGLTFTests.cs プロジェクト: notargs/VCI
        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);
        }