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

Skip to content
Snippets Groups Projects
Commit 179eaf64 authored by Harald Martini's avatar Harald Martini
Browse files

Added Tests for CreateVifViewModel

parent 2952a9de
No related branches found
No related tags found
No related merge requests found
using System.Diagnostics;
using System.IO;
using Ninject;
using NUnit.Framework;
using VECTO3GUI2020.ViewModel.MultiStage.Implementation;
......@@ -58,6 +59,21 @@ namespace Vecto3GUI2020Test.ViewModelTests
}
[Test]
public void SaveFile()
{
LoadValidNonExemptedFiles();
var outputFile = "test.json";
var outputPath = GetFullPath(outputFile);
_createVifViewModel.SaveJob(outputPath);
FileAssert.Exists(outputPath);
Assert.AreEqual(Path.GetDirectoryName(outputPath), _createVifViewModel.DataSource.SourcePath);
Assert.AreEqual(outputPath, _createVifViewModel.DataSource.SourceFile);
}
[Test]
public void LoadNonExemptedCompletedAndExemptedPrimary()
{
......@@ -88,6 +104,12 @@ namespace Vecto3GUI2020Test.ViewModelTests
}
[Test]
public void LoadValidNonExemptedFilesTest()
{
LoadValidNonExemptedFiles();
}
public void LoadValidNonExemptedFiles()
{
var primaryPath = GetTestDataPath(vecto_vehicle_primary_heavyBusSample);
......@@ -95,8 +117,6 @@ namespace Vecto3GUI2020Test.ViewModelTests
Assert.IsTrue(_createVifViewModel.LoadPrimaryInput(primaryPath));
Assert.IsTrue(_createVifViewModel.LoadStageInput(stageInputPath));
}
[Test]
......
using NUnit.Framework;
using VECTO3GUI2020.Model.Multistage;
using TUGraz.VectoCore;
namespace Vecto3GUI2020Test.ViewModelTests
{
[TestFixture]
public class JsonTests
{
[Test]
public void NamingTest()
{
//Membernames have to match JsonKeys for correct serialization/desirialization
Assert.AreEqual(JsonKeys.JsonHeader, nameof(JSONJob.Header));
Assert.AreEqual(JsonKeys.JsonHeader_FileVersion, nameof(JSONJob.Header.FileVersion));
Assert.AreEqual(JsonKeys.JsonBody, nameof(JSONJob.Body));
Assert.AreEqual(JsonKeys.PrimaryVehicle, nameof(JSONJob.Body.PrimaryVehicle));
Assert.AreEqual(JsonKeys.InterimStage, nameof(JSONJob.Body.InterimStage));
}
}
}
\ No newline at end of file
......@@ -196,7 +196,17 @@ namespace Vecto3GUI2020Test
.Callback<string, string>((message, caption) =>
TestContext.WriteLine($"{{caption}}\n {message}"));
_mockDialogHelper.Setup(dialogHelper =>
dialogHelper.ShowErrorMessage(It.IsAny<string>(), It.IsAny<string>()))
.Callback<string, string>((message, caption) =>
TestContext.WriteLine($"{{caption}}\n {message}"));
_mockDialogHelper.Setup(dialogHelper =>
dialogHelper.ShowErrorMessage(It.IsAny<string>()))
.Callback<string, string>((message, caption) =>
TestContext.WriteLine($"{{Error}}\n {message}"));
}
if (fileToLoad != null) {
var filePath = fileToLoad;
......
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