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

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

Merge pull request #209 in VECTO/vecto-sim from...

Merge pull request #209 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:hotfix/VECTO-300-technology-selection-not-considered to master

* commit 'b56a2f22':
  fix: add techlist when provided in input data
  add test to check techlist for json input data
parents 79a0cf31 b56a2f22
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.
Finish editing this message first!
Please register or to comment