diff --git a/VECTO.sln b/VECTO.sln index 8e434e31ea257b6b7293634cc0b7c2fd4ebb028b..6d4ff71f27ed646a5120f913364b3a44702abb21 100644 --- a/VECTO.sln +++ b/VECTO.sln @@ -74,6 +74,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VectoAPI", "..\VECTO_API_DE EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VECTO3GUI2020", "VECTO3GUI2020\VECTO3GUI2020.csproj", "{7E9172D4-07E3-4077-814E-7117AB2B3E22}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vecto3GUITest", "Vecto3GUITest\Vecto3GUITest.csproj", "{31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug PerformanceStats|Any CPU = Debug PerformanceStats|Any CPU @@ -908,6 +910,48 @@ Global {7E9172D4-07E3-4077-814E-7117AB2B3E22}.ReleaseTUG|x64.Build.0 = Release|Any CPU {7E9172D4-07E3-4077-814E-7117AB2B3E22}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU {7E9172D4-07E3-4077-814E-7117AB2B3E22}.ReleaseTUG|x86.Build.0 = Release|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug PerformanceStats|Any CPU.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug PerformanceStats|Any CPU.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug PerformanceStats|x64.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug PerformanceStats|x64.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug PerformanceStats|x86.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug PerformanceStats|x86.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug PerformanceTrace|Any CPU.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug PerformanceTrace|Any CPU.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug PerformanceTrace|x64.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug PerformanceTrace|x64.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug PerformanceTrace|x86.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug PerformanceTrace|x86.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug|x64.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug|x64.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug|x86.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Debug|x86.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.DebugTUG|Any CPU.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.DebugTUG|Any CPU.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.DebugTUG|x64.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.DebugTUG|x64.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.DebugTUG|x86.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.DebugTUG|x86.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Deploy|Any CPU.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Deploy|x64.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Deploy|x64.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Deploy|x86.ActiveCfg = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Deploy|x86.Build.0 = Debug|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Release|Any CPU.Build.0 = Release|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Release|x64.ActiveCfg = Release|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Release|x64.Build.0 = Release|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Release|x86.ActiveCfg = Release|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.Release|x86.Build.0 = Release|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.ReleaseTUG|Any CPU.ActiveCfg = Release|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.ReleaseTUG|Any CPU.Build.0 = Release|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.ReleaseTUG|x64.ActiveCfg = Release|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.ReleaseTUG|x64.Build.0 = Release|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU + {31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}.ReleaseTUG|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/VECTO3GUI2020/Ninject/FactoryModule.cs b/VECTO3GUI2020/Ninject/FactoryModule.cs index 95cc3ca74c62697b3851d0d881775bd4e1120316..8dffd4b7be9e5c7ca138b2a6952be477c2b709b8 100644 --- a/VECTO3GUI2020/Ninject/FactoryModule.cs +++ b/VECTO3GUI2020/Ninject/FactoryModule.cs @@ -18,7 +18,7 @@ namespace VECTO3GUI2020.Ninject { public override void Load() { - Bind<IXMLWriterFactory>().ToFactory(() => new UseFirstArgumentTypeAsNameInstanceProvider()); + Bind<IXMLWriterFactory>().ToFactory(() => new UseFirstArgumentTypeAsNameInstanceProvider(fallback:true)); //Bind<IMultiStageViewModelFactory>().ToFactory(() => new UseFirstArgumentAsNameInstanceProvider(skipFirstArgument: true, fallback: true)); Bind<IMultiStageViewModelFactory>().ToFactory(); Bind<IJobEditViewModelFactory>().ToFactory(() => new UseFirstArgumentTypeAsNameInstanceProvider()); diff --git a/VECTO3GUI2020/Ninject/XMLWriterFactoryModule.cs b/VECTO3GUI2020/Ninject/XMLWriterFactoryModule.cs index 7d82dcb016d722a548a1b2480070c8d01e2a4638..9c9912f5a1c1c854eea2f24d8ddf0fe621aef886 100644 --- a/VECTO3GUI2020/Ninject/XMLWriterFactoryModule.cs +++ b/VECTO3GUI2020/Ninject/XMLWriterFactoryModule.cs @@ -100,6 +100,8 @@ namespace VECTO3GUI2020.Ninject XMLAirDragWriter_v2_0.SUPPORTED_VERSIONS, sv => Bind<IXMLComponentWriter>().To<XMLAirDragWriter_v2_0>().Named(sv)); + Bind<IXMLBusAuxiliariesWriter>().To<XMLBusAuxiliariesWriterMultistage>(); + } } } diff --git a/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLAirDragWriter.cs b/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLAirDragWriter.cs index 6a61bcebf4e7edc0862459de0d5920e48cff6ec3..22cf5149424dc7b11ac8146bba30fa6ac2b71635 100644 --- a/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLAirDragWriter.cs +++ b/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLAirDragWriter.cs @@ -37,6 +37,12 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter return _xElement; } + + public XElement GetElement(XNamespace wrapperNamespace) + { + throw new NotImplementedException(); + } + protected abstract void Initialize(); protected abstract void CreateDataElements(); @@ -65,7 +71,7 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter dataElement.Add(new XElement(_defaultNamespace + XMLNames.AirDrag_CdxA_0, _inputData.AirDragArea_0.ToXMLFormat(2))); dataElement.Add(new XElement(_defaultNamespace + XMLNames.AirDrag_TransferredCDxA, _inputData.TransferredAirDragArea.ToXMLFormat(2))); dataElement.Add(new XElement(_defaultNamespace + XMLNames.AirDrag_DeclaredCdxA, _inputData.AirDragArea.ToXMLFormat(2))); - + } protected override void Initialize() diff --git a/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLBusAuxiliariesWriter.cs b/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLBusAuxiliariesWriter.cs index 5c73182aad2570ccda91a53e9d333774520e85c5..e1a8c3722705efb4bcd09d5e0732c1fadece1e8f 100644 --- a/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLBusAuxiliariesWriter.cs +++ b/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLBusAuxiliariesWriter.cs @@ -1,12 +1,22 @@ -using System.Xml.Linq; +using System.Linq; +using System.Xml.Linq; +using Castle.Core.Internal; +using TUGraz.VectoCommon.BusAuxiliaries; using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Resources; +using VECTO3GUI2020.Util.XML.Interfaces; namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter { - public abstract class XMLBusAuxiliariesWriter + public interface IXMLBusAuxiliariesWriter : IXMLComponentWriter { - private readonly IBusAuxiliariesDeclarationData _inputData; - private XElement _xElement; + + } + + public abstract class XMLBusAuxiliariesWriter : IXMLBusAuxiliariesWriter + { + protected readonly IBusAuxiliariesDeclarationData _inputData; + protected XElement _xElement; protected XMLBusAuxiliariesWriter(IBusAuxiliariesDeclarationData inputData) { @@ -23,6 +33,12 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter return _xElement; } + + public XElement GetElement(XNamespace wrapperNamespace) + { + throw new System.NotImplementedException(); + } + public abstract void Initialize(); public abstract void CreateElements(); @@ -32,6 +48,8 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter public class XMLBusAuxiliariesWriterMultistage : XMLBusAuxiliariesWriter { + + private XNamespace _defaultNamespace; public XMLBusAuxiliariesWriterMultistage(IBusAuxiliariesDeclarationData inputData) : base(inputData) { } @@ -39,12 +57,46 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter public override void Initialize() { - _defaultNamespace = XMLNamespaces.V23; + _defaultNamespace = XMLNamespaces.V28; + _xElement = new XElement(_defaultNamespace + XMLNames.Component_Auxiliaries); } public override void CreateElements() { - throw new System.NotImplementedException(); + + var dataElement = new XElement(_defaultNamespace + XMLNames.ComponentDataWrapper, + new XAttribute(XMLNamespaces.Xsi + XMLNames.Attr_Type, "CompletedVehicleAuxiliaryDataDeclarationType")); + _xElement.Add(dataElement); + + + if (_inputData.ElectricConsumers != null) { + var electricSystemElement = new XElement(_defaultNamespace + XMLNames.BusAux_ElectricSystem); + var ledLightsElement = new XElement(_defaultNamespace + "LEDLights"); + ledLightsElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_Interiorlights, _inputData.ElectricConsumers.InteriorLightsLED)); + ledLightsElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_Dayrunninglights, _inputData.ElectricConsumers.DayrunninglightsLED)); + ledLightsElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_Positionlights, _inputData.ElectricConsumers.PositionlightsLED)); + ledLightsElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_Brakelights, _inputData.ElectricConsumers.BrakelightsLED)); + ledLightsElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_Headlights, _inputData.ElectricConsumers.HeadlightsLED)); + electricSystemElement.Add(ledLightsElement); + dataElement.Add(electricSystemElement); + } + + if (_inputData.HVACAux != null) { + var hvacElement = new XElement(_defaultNamespace + "HVAC"); + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_SystemConfiguration, _inputData.HVACAux.SystemConfiguration.GetXmlFormat())); + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_HeatPumpTypeDriver, _inputData.HVACAux.HeatPumpTypeDriverCompartment.GetLabel())); + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_HeatPumpModeDriver, _inputData.HVACAux.HeatPumpModeDriverCompartment?.GetLabel())); + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_HeatPumpTypePassenger, _inputData.HVACAux.HeatPumpTypePassengerCompartment?.GetLabel())); + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_HeatPumpModePassenger, _inputData.HVACAux.HeatPumpModePassengerCompartment?.GetLabel())); + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_AuxiliaryHeaterPower, _inputData.HVACAux.AuxHeaterPower?.ToXMLFormat(0))); + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_DoubleGlazing, _inputData.HVACAux.DoubleGlazing)); + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_AdjustableAuxiliaryHeater, _inputData.HVACAux.AdjustableAuxiliaryHeater)); + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_SeparateAirDistributionDucts, _inputData.HVACAux.SeparateAirDistributionDucts)); + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_WaterElectricHeater, _inputData.HVACAux.WaterElectricHeater)); + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_AirElectricHeater, _inputData.HVACAux.AirElectricHeater)); + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_OtherHeatingTechnology, _inputData.HVACAux.OtherHeatingTechnology)); + dataElement.Add(hvacElement); + } } #endregion diff --git a/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLVehicleWriter.cs b/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLVehicleWriter.cs index f69a13ef9d91a00dbe6550893c396d59d4c4b272..76f468f4e85cd54af7f688a8d7b3982d656e97cd 100644 --- a/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLVehicleWriter.cs +++ b/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLVehicleWriter.cs @@ -192,7 +192,7 @@ namespace VECTO3GUI2020.Util.XML.Implementation public class XMLVehicleWriter_v2_8 : XMLVehicleWriter { - public new static readonly string[] SUPPORTEDVERSIONS = { + public static readonly string[] SUPPORTEDVERSIONS = { typeof(DeclarationInterimStageBusVehicleViewModel_v2_8).ToString() }; public XMLVehicleWriter_v2_8(IVehicleDeclarationInputData inputData, IXMLWriterFactory xmlWriterFactory) : base(inputData, xmlWriterFactory) @@ -277,18 +277,27 @@ namespace VECTO3GUI2020.Util.XML.Implementation if (_inputData.Components != null) { var componentElement = new XElement( _defaultNamespace + XMLNames.Vehicle_Components, - new XAttribute(XMLNamespaces.Xsi + XMLNames.Components_type_attr, + new XAttribute(XMLNamespaces.Xsi + XMLNames.Attr_Type, "CompletedVehicleComponentsDeclarationType")); //Airdrag if (_inputData.Components.AirdragInputData != null) { var airDragElement = _xmlWriterFactory.CreateComponentWriter(_inputData.Components.AirdragInputData) .GetElement(); + var tempAirDragElement = new XElement(_defaultNamespace + XMLNames.Component_AirDrag); + + airDragElement.Name = tempAirDragElement.Name; componentElement.Add(airDragElement); } //auxiliaries + if (_inputData.Components.BusAuxiliaries != null) { + var auxiliaryElement = _xmlWriterFactory.CreateBuxAuxiliariesWriter(_inputData.Components.BusAuxiliaries) + .GetElement(); + + componentElement.Add(auxiliaryElement); + } _Xelement.Add(componentElement); diff --git a/VECTO3GUI2020/Util/XML/Interfaces/IXMLWriterFactory.cs b/VECTO3GUI2020/Util/XML/Interfaces/IXMLWriterFactory.cs index aca85fc6179225530ab42bf6a87313c5ad54013c..94c82c81bd5e50e00ded437f64ef98ca70e7fd71 100644 --- a/VECTO3GUI2020/Util/XML/Interfaces/IXMLWriterFactory.cs +++ b/VECTO3GUI2020/Util/XML/Interfaces/IXMLWriterFactory.cs @@ -2,6 +2,7 @@ using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Interfaces; using TUGraz.VectoCore.OutputData.XML.Engineering.Interfaces; using TUGraz.VectoCore.OutputData.XML.Engineering.Writer; +using VECTO3GUI2020.Util.XML.Implementation.ComponentWriter; namespace VECTO3GUI2020.Util.XML.Interfaces { @@ -17,5 +18,7 @@ namespace VECTO3GUI2020.Util.XML.Interfaces IXMLComponentWriter CreateComponentWriter(IPTOTransmissionInputData inputData); IXMLComponentsWriter CreateComponentsWriter(IVehicleComponentsDeclaration inputData); + + IXMLBusAuxiliariesWriter CreateBuxAuxiliariesWriter(IBusAuxiliariesDeclarationData inputData); } } diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/ManufacturingStageViewModel_v0_1.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/ManufacturingStageViewModel_v0_1.cs index 362594682a6ff9b69fd4000e1babd9ba829749f2..d22883005fd5da89993dd7ae22dc862c5537ff84 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/ManufacturingStageViewModel_v0_1.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/ManufacturingStageViewModel_v0_1.cs @@ -84,10 +84,6 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation _consolidatedManufacturingStageInputData = consolidatedManufacturingStageInputData; - - - - VehicleViewModel = (IMultistageVehicleViewModel)_viewModelFactory.GetInterimStageVehicleViewModel(consolidatedManufacturingStageInputData.Vehicle); CurrentView = VehicleViewModel as IViewModelBase; diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageJobViewModel_v0_1.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageJobViewModel_v0_1.cs index 2740c0a0d7f326d516ed6c760045de57a0c0dba0..36434ea5181ea179982ae0d8107b8fc70efa8387 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageJobViewModel_v0_1.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageJobViewModel_v0_1.cs @@ -54,6 +54,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation get { return _saveVifCommand ?? new RelayCommand(() => { + SaveVIF(this); }, () => true); } @@ -61,6 +62,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation private static void SaveVIF(IMultistageVIFInputData inputData) { + + var vifInputData = inputData; } @@ -106,7 +109,12 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation Debug.WriteLine(xElement.CreateWrapperDocument(XMLNamespaces.V28).ToString()); var validator = new XMLValidator(xDoc.ToXmlDocument()); - var valid = validator.ValidateXML(XmlDocumentType.DeclarationJobData); + var valid = false; + try { + valid = validator.ValidateXML(XmlDocumentType.DeclarationJobData); + } catch (Exception e) { + _dialogHelper.Value.ShowMessageBox(e.Message, "Error"); + } if (!valid) { _dialogHelper.Value.ShowMessageBox($"Invalid Document: {validator.ValidationError}", "Error"); xDoc.Save(filename, SaveOptions.OmitDuplicateNamespaces); diff --git a/Vecto3GUITest/Properties/AssemblyInfo.cs b/Vecto3GUITest/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..aad2a9d5c3bcf2306838c1dfa404e8f115551cbb --- /dev/null +++ b/Vecto3GUITest/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Vecto3GUITest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Vecto3GUITest")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("31248c1a-85a9-4d4c-9ddb-0d56e1599c7e")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Vecto3GUITest/UITests.cs b/Vecto3GUITest/UITests.cs new file mode 100644 index 0000000000000000000000000000000000000000..6592c853be0489172401ef3d927fd055013c9ff7 --- /dev/null +++ b/Vecto3GUITest/UITests.cs @@ -0,0 +1,32 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Threading; +using OpenQA.Selenium; + +namespace Vecto3GUITest +{ + [TestClass] + public class StartUpScenario : VECTO3GUI2020Session + { + [TestMethod] + public void LoadFile() + { + //session.FindElementByAccessibilityId("Register").FindElementByClassName("Button").Click(); + session.FindElementByName("New Multistage File").Click(); + + + } + + [ClassInitialize] + public static void ClassInitialize(TestContext context) + { + Setup(context); + } + + [ClassCleanup] + public static void ClassCleanup() + { + TearDown(); + } + } +} diff --git a/Vecto3GUITest/VECTO3GUI2020Session.cs b/Vecto3GUITest/VECTO3GUI2020Session.cs new file mode 100644 index 0000000000000000000000000000000000000000..3df9ac7ce21362c0cee55db7ddd63cd33c9480ff --- /dev/null +++ b/Vecto3GUITest/VECTO3GUI2020Session.cs @@ -0,0 +1,58 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using OpenQA.Selenium.Appium.Windows; +using OpenQA.Selenium.Remote; +using OpenQA.Selenium; +using System; +using OpenQA.Selenium.Appium; + +namespace Vecto3GUITest +{ + [TestClass] + public class VECTO3GUI2020Session + { + protected const string WindowsApplicationDriverUrl = "http://127.0.0.1:4723"; + private const string NotepadAppId = @"C:\Windows\System32\notepad.exe"; + + protected static WindowsDriver<WindowsElement> session; + + public static void Setup(TestContext context) + { + // Launch a new instance of Notepad application + if (session == null) + { + // Create a new session to launch Notepad application + var appiumOptions = new OpenQA.Selenium.Appium.AppiumOptions(); + appiumOptions.AddAdditionalCapability("app", @"C:\Users\Harry\source\repos\vecto-dev\VECTO3GUI2020\bin\Debug\VECTO3GUI2020.exe"); + appiumOptions.AddAdditionalCapability("deviceName", "WindowsPC"); + session = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), appiumOptions); + + // Use the session to control the app + Assert.IsNotNull(session); + Assert.IsNotNull(session.SessionId); + + + // Set implicit timeout to 1.5 seconds to make element search to retry every 500 ms for at most three times + session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); + } + } + + public static void TearDown() + { + // Close the application and delete the session + if (session != null) + { + session.Close(); + session.Quit(); + session = null; + } + } + + [TestInitialize] + public void TestInitialize() + { + // Select all text and delete to clear the edit box + } + + protected static string SanitizeBackslashes(string input) => input.Replace("\\", Keys.Alt + Keys.NumberPad9 + Keys.NumberPad2 + Keys.Alt); + } +} diff --git a/Vecto3GUITest/Vecto3GUITest.csproj b/Vecto3GUITest/Vecto3GUITest.csproj new file mode 100644 index 0000000000000000000000000000000000000000..8a1a54e6e5f121a1a99274aab4b3224c8d2c4743 --- /dev/null +++ b/Vecto3GUITest/Vecto3GUITest.csproj @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.props')" /> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{31248C1A-85A9-4D4C-9DDB-0D56E1599C7E}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Vecto3GUITest</RootNamespace> + <AssemblyName>Vecto3GUITest</AssemblyName> + <TargetFrameworkVersion>v4.8</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion> + <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath> + <IsCodedUITest>False</IsCodedUITest> + <TestProjectType>UnitTest</TestProjectType> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Appium.Net, Version=4.3.1.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Appium.WebDriver.4.3.1\lib\net45\Appium.Net.dll</HintPath> + </Reference> + <Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> + <HintPath>..\packages\Castle.Core.4.4.1\lib\net45\Castle.Core.dll</HintPath> + </Reference> + <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\MSTest.TestFramework.2.2.3\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath> + </Reference> + <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\MSTest.TestFramework.2.2.3\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath> + </Reference> + <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> + </Reference> + <Reference Include="Ninject"> + <HintPath>..\..\..\..\.nuget\packages\ninject\3.3.4\lib\net45\Ninject.dll</HintPath> + </Reference> + <Reference Include="SeleniumExtras.PageObjects, Version=3.11.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\DotNetSeleniumExtras.PageObjects.3.11.0\lib\net45\SeleniumExtras.PageObjects.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Configuration" /> + <Reference Include="System.Core" /> + <Reference Include="System.Drawing" /> + <Reference Include="WebDriver, Version=3.141.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Selenium.WebDriver.3.141.0\lib\net45\WebDriver.dll</HintPath> + </Reference> + <Reference Include="WebDriver.Support, Version=3.141.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Selenium.Support.3.141.0\lib\net45\WebDriver.Support.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="UITests.cs" /> + <Compile Include="VECTO3GUI2020Session.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="XMLWriterTest.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\VectoCore\VectoCore\VectoCore.csproj"> + <Project>{CD36938A-ADD9-4C65-96DA-B397CDEEA90A}</Project> + <Name>VectoCore</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" /> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.props'))" /> + <Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.targets'))" /> + </Target> + <Import Project="..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.targets')" /> +</Project> \ No newline at end of file diff --git a/Vecto3GUITest/XMLWriterTest.cs b/Vecto3GUITest/XMLWriterTest.cs new file mode 100644 index 0000000000000000000000000000000000000000..2d1c01ee2cb67b074d546ce218b7ce25273f7ec6 --- /dev/null +++ b/Vecto3GUITest/XMLWriterTest.cs @@ -0,0 +1,27 @@ +using System.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Ninject; +using TUGraz.VectoCore; +using TUGraz.VectoCore.InputData.FileIO.XML; + + +namespace Vecto3GUITest +{ + [TestClass] + public class WriterTests + { + private StandardKernel _kernel; + private IXMLInputDataReader _xmlInputReader; + + + public void Setup() + { + _kernel = new StandardKernel(new VectoNinjectModule()); + _xmlInputReader = _kernel.Get<IXMLInputDataReader>(); + } + + + + } + +} \ No newline at end of file diff --git a/Vecto3GUITest/app.config b/Vecto3GUITest/app.config new file mode 100644 index 0000000000000000000000000000000000000000..fdc60f6f83437dedadf5df7aad3f232919b15e36 --- /dev/null +++ b/Vecto3GUITest/app.config @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration> \ No newline at end of file diff --git a/Vecto3GUITest/packages.config b/Vecto3GUITest/packages.config new file mode 100644 index 0000000000000000000000000000000000000000..34fc3dad972f72368ab1e8087afbd9b245797fca --- /dev/null +++ b/Vecto3GUITest/packages.config @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Appium.WebDriver" version="4.3.1" targetFramework="net48" /> + <package id="Castle.Core" version="4.4.1" targetFramework="net48" /> + <package id="DotNetSeleniumExtras.PageObjects" version="3.11.0" targetFramework="net48" /> + <package id="MSTest.TestAdapter" version="2.2.3" targetFramework="net48" /> + <package id="MSTest.TestFramework" version="2.2.3" targetFramework="net48" /> + <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" /> + <package id="Ninject" version="3.3.4" targetFramework="net48" /> + <package id="Selenium.Support" version="3.141.0" targetFramework="net48" /> + <package id="Selenium.WebDriver" version="3.141.0" targetFramework="net48" /> +</packages> \ No newline at end of file diff --git a/VectoCommon/VectoCommon/BusAuxiliaries/ISSMInputs.cs b/VectoCommon/VectoCommon/BusAuxiliaries/ISSMInputs.cs index 2f5a2f8ad2a9c315e943e730f8d3a8293afb5a9c..211313f68179665c058c3c312a299ae597105edc 100644 --- a/VectoCommon/VectoCommon/BusAuxiliaries/ISSMInputs.cs +++ b/VectoCommon/VectoCommon/BusAuxiliaries/ISSMInputs.cs @@ -244,6 +244,15 @@ namespace TUGraz.VectoCommon.BusAuxiliaries default: return null; } } + + public static string GetLabel(this HeatPumpType? type) + { + if (type.HasValue) { + return type.Value.GetLabel(); + } else { + return null; + } + } } diff --git a/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/123.xml b/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/123.xml index d1c8373bc5765302e26e39d93950f2a884f3bca1..423a29ae00ec4841dc3ec632d10cfd59003e26ac 100644 --- a/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/123.xml +++ b/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/123.xml @@ -4,7 +4,7 @@ <Manufacturer>Some Manufacturer</Manufacturer> <ManufacturerAddress>Some Manufacturer Address</ManufacturerAddress> <VIN>VEH-1234567890</VIN> - <Date>2021-05-01T22:00:00Z</Date> + <Date>2021-05-02T22:00:00Z</Date> <Model>Sample Bus Model</Model> <LegislativeCategory>M3</LegislativeCategory> <CorrectedActualMass>500</CorrectedActualMass> @@ -14,10 +14,6 @@ <ClassBus>II+III</ClassBus> <VehicleCode>CB</VehicleCode> <LowEntry>false</LowEntry> - <HeightIntegratedBody>2500</HeightIntegratedBody> - <VehicleLength>9500</VehicleLength> - <VehicleWidth>2500</VehicleWidth> - <EntranceHeight>2000</EntranceHeight> <DoorDriveTechnology>electric</DoorDriveTechnology> <DeclarationType>interim</DeclarationType> <ADAS> @@ -26,5 +22,33 @@ <v2.3:EcoRollWithEngineStop>false</v2.3:EcoRollWithEngineStop> <v2.3:PredictiveCruiseControl>none</v2.3:PredictiveCruiseControl> </ADAS> + <Components xsi:type="CompletedVehicleComponentsDeclarationType"> + <Auxiliaries> + <Data xsi:type="CompletedVehicleAuxiliaryDataDeclarationType"> + <ElectricSystem> + <LEDLights> + <Interiorlights>false</Interiorlights> + <Dayrunninglights>true</Dayrunninglights> + <Positionlights>true</Positionlights> + <Brakelights>true</Brakelights> + <Headlights>false</Headlights> + </LEDLights> + </ElectricSystem> + <HVAC> + <SystemConfiguration>0</SystemConfiguration> + <HeatPumpTypeDriverCompartment>none</HeatPumpTypeDriverCompartment> + <HeatPumpModeDriverCompartment>heating</HeatPumpModeDriverCompartment> + <HeatPumpTypePassengerCompartment>non R-744 2-stage</HeatPumpTypePassengerCompartment> + <HeatPumpModePassengerCompartment>cooling</HeatPumpModePassengerCompartment> + <AuxiliaryHeaterPower>50</AuxiliaryHeaterPower> + <DoubleGlazing>false</DoubleGlazing> + <AdjustableAuxiliaryHeater>true</AdjustableAuxiliaryHeater> + <WaterElectricHeater>true</WaterElectricHeater> + <AirElectricHeater>false</AirElectricHeater> + <OtherHeatingTechnology>false</OtherHeatingTechnology> + </HVAC> + </Data> + </Auxiliaries> + </Components> </v2.0:Vehicle> </tns:VectoInputDeclaration> \ No newline at end of file