Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 3bdc0358 authored by Harald MARTINI's avatar Harald MARTINI
Browse files

updated schemaset in MRF Testcases

parent 54ee3589
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,7 @@ using TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.Manu
using TUGraz.VectoCore.OutputData.XML.DeclarationReports.ManufacturerReport.ManufacturerReport_0_9.ManufacturerReportXMLTypeWriter;
using TUGraz.VectoCore.Tests.Integration.CompletedBus;
using TUGraz.VectoCore.Tests.Models.Simulation;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.Tests.XML.Reports
{
......@@ -88,20 +89,45 @@ namespace TUGraz.VectoCore.Tests.XML.Reports
protected bool ValidateAndPrint(XDocument document)
{
var error = false;
var schemas = XmlSchemaSet(
(Path.GetFullPath("../../../VectoCore/Resources/XSD/VectoOutputManufacturer.0.9.xsd"), "urn:tugraz:ivt:VectoAPI:DeclarationOutput:v0.9"),
(Path.GetFullPath("../../../VectoCore/Resources/XSD/VectoOutputCustomer.0.9.xsd"), "urn:tugraz:ivt:VectoAPI:CustomerOutput:v0.9"));
document.Validate(schemas, (sender, args) => {
error = true;
TestContext.WriteLine(sender.ToString());
TestContext.WriteLine(args.Message);
});
TestContext.WriteLine(document);
try {
var schemaSet = new XmlSchemaSet() {
XmlResolver = new XmlUrlResolver()
};
XmlSchema schema;
using (var reader = XmlReader.Create(
Path.GetFullPath("../../../../VectoCore/Resources/XSD/VectoOutputManufacturer.0.9.xsd")))
{
schema = XmlSchema.Read(reader, null);
}
schemaSet.Add(schema);
using (var reader = XmlReader.Create(
Path.GetFullPath("../../../../VectoCore/Resources/XSD/VectoOutputCustomer.0.9.xsd")))
{
schema = XmlSchema.Read(reader, null);
}
schemaSet.Add(schema);
document.Validate(schemaSet, (sender, args) => {
error = true;
TestContext.WriteLine(sender?.ToString());
TestContext.WriteLine(args.Message);
});
} finally {
TestContext.WriteLine(document);
}
return !error;
}
private static XmlSchemaSet XmlSchemaSet(params (string path, string targetNamespace)[] paths)
{
XmlSchemaSet schemas = new XmlSchemaSet();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment