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

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

adding testcase where mod-file is opened and writing mod data will fail

parent 582dc58f
No related branches found
No related tags found
No related merge requests found
......@@ -225,5 +225,37 @@ namespace TUGraz.VectoCore.Tests.Reports
Assert.AreEqual(dataProvider.JobInputData.Vehicle.EngineInputData.WHTCMotorway,
sumRow[SummaryDataContainer.ENGINE_WHTC_MOTORWAY]);
}
[TestCase()]
public void TestSumDataIsCompleteEvenIfModFileCannotBeWritten()
{
var jobFile = @"TestData\Integration\DeclarationMode\Class5_Vocational\Tractor_4x2_vehicle-class-5_EURO6_2018.xml";
var modFilename = Path.Combine(Path.GetDirectoryName(jobFile), "VEH-Class5_ConstructionReferenceLoad_sim.vmod");
// lock modfile so it can't be written
Stream fh = !File.Exists(modFilename) ? File.Create(modFilename) : File.OpenRead(modFilename);
var writer = new FileOutputWriter(jobFile);
var inputData = new XMLDeclarationInputDataProvider(jobFile, true);
var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, writer) {
WriteModalResults = true,
ActualModalData = true
};
var sumWriter = new SummaryDataContainer(writer);
var jobContainer = new JobContainer(sumWriter);
jobContainer.AddRuns(factory);
jobContainer.Execute();
jobContainer.WaitFinished();
Assert.AreEqual(2, sumWriter.Table.Rows.Count);
fh.Close();
}
}
}
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