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

Skip to content
Snippets Groups Projects
Commit b4f7c900 authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

adapting testcase to serialize rundata for truck

parent bc1b2fc9
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.InputData.FileIO.JSON;
using TUGraz.VectoCore.InputData.FileIO.XML;
using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.Models.Simulation.Impl;
......@@ -34,6 +35,7 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus
public class CompletedBusFactorMethodTest
{
const string JobFile = @"TestData\Integration\Buses\FactorMethod\CompletedBus.vecto";
protected IXMLInputDataReader xmlInputReader;
class RelatedRun
{
......@@ -54,6 +56,8 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus
relatedRuns = new List<RelatedRun>();
var kernel = new StandardKernel(new VectoNinjectModule());
xmlInputReader = kernel.Get<IXMLInputDataReader>();
//SetBusSegments();
}
......@@ -909,11 +913,12 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus
}
[TestCase()]
public void PrintModelParameters()
[TestCase(JobFile),
TestCase(@"TestData\XML\XMLReaderDeclaration\vecto_vehicle-sample.xml")]
public void PrintModelParameters(string jobFile)
{
var writer = new FileOutputWriter(Path.Combine(Path.GetDirectoryName(JobFile), Path.GetFileName(JobFile)));
var inputData = JSONInputDataFactory.ReadJsonJob(JobFile);
var inputData = Path.GetExtension(jobFile).Equals(".xml") ? xmlInputReader.CreateDeclaration(jobFile) : JSONInputDataFactory.ReadJsonJob(jobFile);
var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, writer) {
WriteModalResults = true,
......@@ -925,13 +930,13 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus
var runs = factory.DataReader.NextRun().ToList();
Assert.IsTrue(runs.Count == 8 || runs.Count == 12);
//Assert.IsTrue(runs.Count == 8 || runs.Count == 12);
SetRelatedVehicleParts(runs);
var pair = relatedRuns.First();
var json = JToken.FromObject(pair.VectoRunDataGenericBody);
File.WriteAllText($"{pair.VectoRunDataGenericBody.JobName}_{pair.VectoRunDataGenericBody.ModFileSuffix}_Generic.json", JsonConvert.SerializeObject(json, Formatting.Indented));
//var json = JToken.FromObject(pair.VectoRunDataGenericBody);
File.WriteAllText($"{pair.VectoRunDataGenericBody.JobName}_{pair.VectoRunDataGenericBody.ModFileSuffix}_Generic.json", JsonConvert.SerializeObject(pair.VectoRunDataGenericBody, Formatting.Indented));
//Console.WriteLine("Generic Body");
//PrintVectoRunData(pair.VectoRunDataGenericBody);
......
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