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

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

adding testcase to check CO2Standards Group is set to N/A for vocational vehicles

parent 21ab825d
No related branches found
No related tags found
No related merge requests found
...@@ -32,16 +32,23 @@ ...@@ -32,16 +32,23 @@
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Xml;
using System.Xml.XPath;
using Ninject; using Ninject;
using NUnit.Framework; using NUnit.Framework;
using NUnit.Framework.Internal; using NUnit.Framework.Internal;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.InputData.FileIO.JSON; using TUGraz.VectoCore.InputData.FileIO.JSON;
using TUGraz.VectoCore.InputData.FileIO.XML; using TUGraz.VectoCore.InputData.FileIO.XML;
using TUGraz.VectoCore.InputData.FileIO.XML.Declaration; using TUGraz.VectoCore.InputData.FileIO.XML.Declaration;
using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.Simulation.Impl;
using TUGraz.VectoCore.OutputData;
using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.OutputData.FileIO;
using TUGraz.VectoCore.Tests.Integration.Declaration;
using TUGraz.VectoCore.Tests.Models.Simulation; using TUGraz.VectoCore.Tests.Models.Simulation;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.Tests.Integration namespace TUGraz.VectoCore.Tests.Integration
{ {
...@@ -91,5 +98,44 @@ namespace TUGraz.VectoCore.Tests.Integration ...@@ -91,5 +98,44 @@ namespace TUGraz.VectoCore.Tests.Integration
var progress = jobContainer.GetProgress(); var progress = jobContainer.GetProgress();
Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat<Exception>(progress.Select(r => r.Value.Error))); Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat<Exception>(progress.Select(r => r.Value.Error)));
} }
[Category("LongRunning")]
[TestCase(Class4Vocational, 4),
TestCase(Class5Vocational, 2)]
public void VocationalTestCO2StandardsGroup(string filename, int numRuns)
{
var writer = new MockDeclarationWriter(filename);
var inputData = xmlInputReader.CreateDeclaration(filename);
var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, writer) {
WriteModalResults = true,
ActualModalData = true,
ValidateComponentHashes = false
};
var jobContainer = new JobContainer(new MockSumWriter());
var runs = factory.SimulationRuns().ToList();
Assert.AreEqual(numRuns, runs.Count);
foreach (var run in runs) {
jobContainer.AddRun(run);
}
//jobContainer.AddRuns(factory);
jobContainer.Execute();
jobContainer.WaitFinished();
var progress = jobContainer.GetProgress();
Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat<Exception>(progress.Select(r => r.Value.Error)));
foreach (var reportType in new[]{ReportType.DeclarationReportCustomerXML, ReportType.DeclarationReportManufacturerXML}) {
var rpt = writer.GetReport(reportType);
var vocationalNode = rpt.XPathSelectElement(XMLHelper.QueryLocalName(XMLNames.Vehicle_VocationalVehicle));
Assert.NotNull(vocationalNode);
Assert.IsTrue(XmlConvert.ToBoolean(vocationalNode.Value));
var co2StandardsNode = rpt.XPathSelectElement(XMLHelper.QueryLocalName(XMLNames.Report_CO2StandardsGroup));
Assert.NotNull(co2StandardsNode);
Assert.AreEqual(Constants.NOT_AVAILABLE, co2StandardsNode.Value);
}
}
} }
} }
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