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

Skip to content
Snippets Groups Projects
Commit e449945d authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

adding testcase for valid xml reports LNG vehicles

parent bc33c6b2
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,7 @@
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="FuelType" type="vdecdef:FuelTypeType"/>
<xs:element name="FuelType" type="xs:string"/>
<xs:element name="AverageSpeed">
<xs:complexType>
<xs:simpleContent>
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -2755,6 +2755,9 @@
<Content Include="TestData\XML\XMLReaderDeclaration\vecto_vehicle-sample_exempted.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\XML\XMLReaderDeclaration\vecto_vehicle-sample_LNG.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\XML\XMLReaderDeclaration\vecto_vehicle-sample_FULL_updated.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
......
......@@ -30,6 +30,7 @@
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Xml.Schema;
......@@ -47,6 +48,7 @@ namespace TUGraz.VectoCore.Tests.XML
{
const string SampleVehicleDecl = "TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample.xml";
const string SampleVehicleDeclTqLimits = "TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample_torqueLimits.xml";
const string SampleVehicleDeclLNG = "TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample_LNG.xml";
const string SampleVehicleDeclAT = "TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample_AT.xml";
......@@ -58,7 +60,8 @@ namespace TUGraz.VectoCore.Tests.XML
[TestCase(SampleVehicleDecl),
TestCase(SampleVehicleDeclTqLimits),
TestCase(SampleVehicleDeclAT)]
TestCase(SampleVehicleDeclAT),
TestCase(SampleVehicleDeclLNG)]
public void RunDeclarationJob(string filename)
{
var fileWriter = new FileOutputWriter(filename);
......@@ -77,12 +80,19 @@ namespace TUGraz.VectoCore.Tests.XML
var customerRecord = fileWriter.XMLCustomerReportName;
var manufacturerRecord = fileWriter.XMLFullReportName;
var validator1 = new XMLValidator(XmlReader.Create(customerRecord));
Assert.IsTrue(validator1.ValidateXML(XMLValidator.XmlDocumentType.CustomerReport), customerRecord);
var validator2 = new XMLValidator(XmlReader.Create(manufacturerRecord));
Assert.IsTrue(validator2.ValidateXML(XMLValidator.XmlDocumentType.ManufacturerReport), manufacturerRecord);
var validationMsg1 = new List<string> {customerRecord} ;
var validator1 = new XMLValidator(XmlReader.Create(customerRecord), validationErrorAction: (s,e) => {
validationMsg1.Add(e.ValidationEventArgs.Message);
});
Assert.IsTrue(validator1.ValidateXML(XMLValidator.XmlDocumentType.CustomerReport), string.Join("\n", validationMsg1));
var validationMsg2 = new List<string> {manufacturerRecord};
var validator2 = new XMLValidator(XmlReader.Create(manufacturerRecord), validationErrorAction: (s,e) => {
validationMsg2.Add(e.ValidationEventArgs.Message);
});
Assert.IsTrue(validator2.ValidateXML(XMLValidator.XmlDocumentType.ManufacturerReport), string.Join("\n", validationMsg2));
}
}
}
\ No newline at end of file
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