Пример #1
0
        public void JsonModel_SeresBasic_ShouldDeserializeAndValidate()
        {
            var json = EmbeddedResource.LoadDataFromEmbeddedResourceAsString(SERESBASIC_JSON_RESOURCE);

            _TestData.Model.CSharp.melding melding = JsonSerializer.Deserialize <_TestData.Model.CSharp.melding>(json);

            melding.E1.Should().Be("Yo");
        }
Пример #2
0
        public void XmlModel_SeresBasic_ShouldValidate()
        {
            var xml = EmbeddedResource.LoadDataFromEmbeddedResourceAsString(SERESBASIC_XML_RESOURCE);

            var validXml = ValidateXml(xml);

            validXml.Should().BeTrue();
        }
Пример #3
0
        public async Task JsonModel_SeresBasic_ShouldValidate()
        {
            var json       = EmbeddedResource.LoadDataFromEmbeddedResourceAsString(SERESBASIC_JSON_RESOURCE);
            var jsonSchema = await EmbeddedResource.LoadDataFromEmbeddedResourceAsJsonSchema(SERESBASIC_JSON_SCHEMA_RESOURCE);

            var jsonDocument = JsonDocument.Parse(json);

            var validationResults = jsonSchema.Validate(jsonDocument.RootElement, new ValidationOptions()
            {
                OutputFormat = OutputFormat.Detailed
            });

            validationResults.IsValid.Should().BeTrue();
        }