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

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

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

Merge pull request #541 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:bugfix/VECTO-602-error-in-simulation-without-airdrag to master

* commit 'ad064b96':
  adding testcase for xml declaration vehicle without airdrag component
  check if airdrag node exists, oterwise return null (uses standard values)
parents 6155aaef ad064b96
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration
public SquareMeter AirDragArea
{
get { return GetDoubleElementValue(XMLNames.AirDrag_DeclaredCdxA).SI<SquareMeter>(); }
get { return ElementExists(XMLNames.AirDrag_DeclaredCdxA) ? GetDoubleElementValue(XMLNames.AirDrag_DeclaredCdxA).SI<SquareMeter>() : null; }
}
}
}
\ No newline at end of file
......@@ -35,10 +35,8 @@ using System.Data;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using DocumentFormat.OpenXml.Spreadsheet;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -2546,6 +2546,9 @@
<ItemGroup>
<Content Include="TestData\XML\XMLReaderDeclaration\vecto_engine-sample.xml" />
<Content Include="TestData\XML\XMLReaderDeclaration\vecto_gearbox-sample.xml" />
<Content Include="TestData\XML\XMLReaderDeclaration\vecto_vehicle-sample_noAirdrag.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\XML\XMLReaderDeclaration\vecto_vehicle-sample.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
......
......@@ -56,11 +56,18 @@ namespace TUGraz.VectoCore.Tests.XML
public class XMLDeclarationInputTest
{
const string SampleVehicleDecl = "TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample.xml";
const string SampleVehicleDeclNoAirdrag = "TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample_noAirdrag.xml";
const string SampleVehicleFullDecl = "TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample_FULL.xml";
const string SampleVehicleFullDeclCertificationOptions =
"TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample_certificationOptions.xml";
[OneTimeSetUp]
public void Init()
{
Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
}
[TestCase]
public void TestXMLInputEng()
{
......@@ -330,6 +337,16 @@ namespace TUGraz.VectoCore.Tests.XML
Assert.AreEqual(1.0, inputDataProvider.RetarderInputData.Ratio);
}
[TestCase]
public void TestVehicleInputNoAirdrag()
{
var reader = XmlReader.Create(SampleVehicleDeclNoAirdrag);
var inputDataProvider = new XMLDeclarationInputDataProvider(reader, true);
Assert.IsNull(inputDataProvider.AirdragInputData.AirDragArea);
}
[TestCase]
public void TestXMLPowertrainGeneration()
{
......
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