Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

added completed bus tests

parent d0c60636
No related branches found
No related tags found
No related merge requests found
......@@ -118,7 +118,7 @@ public static class MockDocument
var mock = new Mock<IMultistageVIFInputData>();
mock.SetupGet(m => m.MultistageJobInputData).Returns(GetMultistepInput(vifVersion, vifType, stages));
mock.SetupGet(m => m.VehicleInputData).Returns(GetStepInput(stepType, stepVersion).Vehicle);
mock.SetupGet(m => m.DataSource.SourceFile).Returns("mocked.vecto");
return mock.Object;
......
using System;
using System.CodeDom;
using System.Runtime.CompilerServices;
using System.Security.RightsManagement;
using Ninject;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCore;
......@@ -60,4 +61,21 @@ namespace Vecto3GUI2020Test
return name;
}
}
public static class IKernelHelperTest
{
public static MockDialogHelper GetMockDialogHelper(this IKernel k)
{
var mockDialogHelper = k.Get<IDialogHelper>() as MockDialogHelper;
return mockDialogHelper;
}
public static MockWindowHelper GetMockWindowHelper(this IKernel k)
{
var mockWindowHelper = k.Get<IWindowHelper>() as MockWindowHelper;
return mockWindowHelper;
}
}
}
\ No newline at end of file
......@@ -45,6 +45,7 @@ public class MockDialogHelper : IDialogHelper
public int NrErrors => _dialogs.Count(d => d.Type == Dialog.DialogType.Error);
private Stack<string> _fileNames = new Stack<string>();
#region Implementation of IDialogHelper
public string OpenFileDialog(string filter = "All files (*.*)|*.*", string initialDirectory = null)
......@@ -89,7 +90,7 @@ public class MockDialogHelper : IDialogHelper
public string SaveToXMLDialog(string initialDirectory = null)
{
throw new System.NotImplementedException();
return _fileNames.Pop();
}
public string SaveToVectoJobDialog(string initialDirectory = null)
......@@ -136,5 +137,10 @@ public class MockDialogHelper : IDialogHelper
return ShowErrorMessage(errorMessage, "-");
}
public void PushFileName(string fileName)
{
_fileNames.Push(fileName);
}
#endregion
}
\ No newline at end of file
......@@ -46,6 +46,11 @@
<Link>TestData\Integration\Multistage\%(RecursiveDir)%(FileName)%(Extension)</Link>
<!--<TargetPath>TestData\Integration\Multistage</TargetPath>-->
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\VectoCore\VectoCoreTest\TestData\Integration\Buses\FactorMethod\**\*.*">
<Link>TestData\Integration\Multistage\FactorMethod\%(RecursiveDir)%(FileName)%(Extension)</Link>
<!--<TargetPath>TestData\Integration\Multistage</TargetPath>-->
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<!--<Content Remove="..\VectoCore\VectoCoreTest\TestData\Integration\Multistage\newVifCompletedConventional.vecto" />
<Content Remove="..\VectoCore\VectoCoreTest\TestData\Integration\Multistage\newVifExempted.vecto" />
......
......@@ -118,7 +118,9 @@ namespace Vecto3GUI2020Test.ViewModelTests.FactoryTests
IMultistageVIFInputData vifInputData = MockDocument.GetMultistepVIFInputData(vifNs, vifType, stages, stepType, stepNs);
Assert.Throws<VectoException>(() => _documentViewModelFactory.CreateDocumentViewModel(vifInputData));
var doc = _documentViewModelFactory.CreateDocumentViewModel(vifInputData);
Assert.NotNull(doc);
}
[TestCase(XMLDefinitions.DECLARATION_DEFINITIONS_NAMESPACE_URI_V24, XMLDeclarationConventionalPrimaryBusVehicleDataProviderV24.XSD_TYPE, XMLDefinitions.DECLARATION_DEFINITIONS_NAMESPACE_URI_V24, XMLDeclarationConventionalCompletedBusDataProviderV24.XSD_TYPE)]
......
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Ninject;
using NUnit.Framework;
using TUGraz.VectoCore;
using TUGraz.VectoCore.InputData.FileIO.XML;
using VECTO3GUI2020.Ninject;
using VECTO3GUI2020.Ninject.Factories;
using VECTO3GUI2020.ViewModel.Interfaces;
using VECTO3GUI2020.ViewModel.MultiStage.Implementation;
using Vecto3GUI2020Test.Utils;
namespace Vecto3GUI2020Test.XML.XMLWritingTest;
[TestFixture]
public class XMLCompleteBus
{
public const string BASEDIR = @"TestData/Integration/Multistage/FactorMethod";
private ThreadLocal<IKernel> _kernel;
private IKernel Kernel => _kernel.Value;
[OneTimeSetUp]
public void OneTimeSetup()
{
_kernel = new ThreadLocal<IKernel>(TestHelper.GetKernel);
}
[TestCase("CompletedBus_41-32b_AT-P.vecto")]
[TestCase("CompletedBus_42-33b.vecto")]
public async Task LoadCompletedBus(string completedJob)
{
var filePath = Path.GetFullPath(Path.Combine(BASEDIR, completedJob));
Assert.IsTrue(File.Exists(filePath), "missing file " + filePath);
var jobList = Kernel.Get<IJobListViewModel>();
var doc = await jobList.AddJobAsync(filePath);
Assert.NotNull(doc);
var editingViewModel = doc.EditViewModel as MultiStageJobViewModel_v0_1;
var md = Kernel.GetMockDialogHelper();
md.PushFileName("test.xml");
editingViewModel.SaveVIFCommand.Execute(null);
md.AssertNoErrorDialogs();
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment