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

Skip to content
Snippets Groups Projects
Commit 0c3db0e1 authored by Harald MARTINI's avatar Harald MARTINI
Browse files

Adapted Airdrag Test cases

parent c2907235
No related branches found
No related tags found
No related merge requests found
......@@ -151,14 +151,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
MultistageAirdragViewModel.AirdragViewModelChanged += ((sender, args) => {
if (sender is IMultistageAirdragViewModel vm) {
if (AirdragModifiedMultistageMandatory) {
if (vm.AirDragViewModel != null)
{
AirdragModifiedMultistage = true;
}
else
{
AirdragModifiedMultistage = false;
}
AirdragModifiedMultistage = vm.AirDragViewModel != null;
}
}
});
......@@ -173,13 +166,13 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
if (consolidatedVehicleData?.AirdragModifiedMultistage != null)
{
_airdragModifiedMultistageMandatory = true;
AirdragModifiedMultistageMandatory = true;
AirdragModifiedMultistageEditingEnabled = true;
}
if (consolidatedVehicleData?.Components?.AirdragInputData != null)
{
_airdragModifiedMultistageMandatory = true;
AirdragModifiedMultistageMandatory = true;
AirdragModifiedMultistageEditingEnabled = true;
}
}
......
......@@ -225,13 +225,13 @@ namespace Vecto3GUI2020Test
Assert.Null(vifInputData.VehicleInputData.Components);
}
[TestCase(consolidated_multiple_stages_airdrag)]
[TestCase(consolidated_multiple_stages)]
[TestCase(consolidated_one_stage)]
[TestCase(primary_vehicle_only)]
public void loadAirdragComponentAndSaveVehicleData(string fileName)
[TestCase(consolidated_multiple_stages_airdrag, true)]
[TestCase(consolidated_multiple_stages, null)]
[TestCase(consolidated_one_stage, null)]
[TestCase(primary_vehicle_only, null)]
public void loadAirdragComponentAndSaveVehicleData(string fileName, object expectedAirdragModifiedValue)
{
var vm = loadFile(consolidated_multiple_stages_airdrag);
var vm = loadFile(fileName);
var vehicleVm =
vm.MultiStageJobViewModel.ManufacturingStageViewModel.VehicleViewModel as
......@@ -261,17 +261,18 @@ namespace Vecto3GUI2020Test
Assert.IsTrue(File.Exists(savePath));
TestContext.WriteLine("Done!");
TestContext.WriteLine("Checking saved File ...");
TestContext.WriteLine("Checking saved File ... ");
var inputData = (IDeclarationInputDataProvider)_kernel.Get<IXMLInputDataReader>().Create(savePath);
Assert.NotNull(inputData.JobInputData.Vehicle.Components.AirdragInputData, "No Airdrag Component loaded");
var airdragData = inputData.JobInputData.Vehicle.Components.AirdragInputData;
Assert.IsTrue(vehicleVm.AirdragModifiedMultistage);
Assert.AreEqual(expectedAirdragModifiedValue, vehicleVm.AirdragModifiedMultistage);
TestContext.WriteLine("Done!");
File.Delete(savePath);
......
......@@ -4,12 +4,15 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ninject;
using NUnit.Framework;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.InputData.FileIO.XML;
using VECTO3GUI2020.Annotations;
using VECTO3GUI2020.ViewModel.Implementation.JobEdit.Vehicle.Components;
using VECTO3GUI2020.ViewModel.MultiStage.Implementation;
using VECTO3GUI2020.ViewModel.MultiStage.Interfaces;
namespace Vecto3GUI2020Test.ViewModelTests
{
......@@ -115,6 +118,10 @@ namespace Vecto3GUI2020Test.ViewModelTests
Assert.IsNull(vehicleVM.AirdragModifiedMultistage);
Assert.IsFalse(vehicleVM.AirdragModifiedMultistageMandatory);
var airdragViewModel = vehicleVM.MultistageAirdragViewModel;
Assert.IsTrue(airdragViewModel.LoadAirdragFile(GetFullPath(airdragLoadTestFile)), "Airdrag file not loaded");
Assert.IsFalse(vehicleVM.AirdragModifiedMultistageMandatory);
vehicleVM.AirdragModifiedMultistageEditingEnabled = true;
Assert.IsFalse(vehicleVM.AirdragModifiedMultistageEditingEnabled);
......
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