Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

Merge pull request #210 in VECTO/vecto-sim from master to develop

* commit '725ca60e':
  fix: add techlist when provided in input data
  add test to check techlist for json input data
parents a769d748 725ca60e
No related branches found
No related tags found
No related merge requests found
......@@ -508,6 +508,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
Type = aux.GetEx<string>("Type"),
Technology = aux.GetEx<string>("Technology")
};
if (aux["TechList"] != null) {
auxData.TechList = aux["TechList"].Select(x => x.ToString()).ToList(); // .Select(x => x.ToString).ToArray();
}
var auxFile = aux["Path"];
retVal.Add(auxData);
......
......@@ -30,6 +30,7 @@
*/
using System.IO;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
......@@ -152,6 +153,22 @@ namespace TUGraz.VectoCore.Tests.FileIO
() => { var tmp = new JSONInputDataV2(json, TestJobFile).DriverInputData.OverSpeedEcoRoll; },
"Key OverSpeedEcoRoll not found");
}
[TestMethod]
public void TestReadingElectricTechlist()
{
var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile)));
((JArray)json["Body"]["Aux"][3]["TechList"]).Add("LED lights");
var job = new JSONInputDataV2(json, TestJobFile);
foreach (var aux in job.Auxiliaries) {
if (aux.ID == "ES") {
Assert.AreEqual(1, aux.TechList.Count);
Assert.AreEqual("LED lights", aux.TechList.First());
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment