diff --git a/Tools/VectoLegacyTests/TorqueConverterTest.cs b/Tools/VectoLegacyTests/TorqueConverterTest.cs index 64a4cbe3c8e1b69262833ab77615c1ff88ce668c..1949838c0b3ff5ef5f1236274af7271979bddfa6 100644 --- a/Tools/VectoLegacyTests/TorqueConverterTest.cs +++ b/Tools/VectoLegacyTests/TorqueConverterTest.cs @@ -38,7 +38,7 @@ using TUGraz.VECTO; namespace VectoLegacyTests { - [TestClass] + [TestFixture] public class TorqueConverterTest { [ClassInitialize] diff --git a/VectoCommon/VectoHashingTest/BasicHasingTests.cs b/VectoCommon/VectoHashingTest/BasicHasingTests.cs index db08cc87028b42d6989e94f6df53b2b8d6bb230c..e352f459b9ff42895eea6e488faa1545d17952c7 100644 --- a/VectoCommon/VectoHashingTest/BasicHasingTests.cs +++ b/VectoCommon/VectoHashingTest/BasicHasingTests.cs @@ -29,106 +29,111 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; -using System.Text; -using System.Xml; -using System.Xml.XPath; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoHashing; -using TUGraz.VectoHashing.Impl; -using TUGraz.VectoHashing.Util; - -namespace VectoHashingTest -{ - [TestClass] - public class BasicHasingTests - { - public const string SimpleXML = @"Testdata\XML\simple_document.xml"; - public const string ReferenceXMLEngine = @"Testdata\XML\Reference\vecto_engine-sample.xml"; - public const string ReferenceXMLVehicle = @"Testdata\XML\Reference\vecto_vehicle-sample_FULL.xml"; - - public const string UnorderedXMLVehicle = @"Testdata\XML\Variations\vecto_vehicle-sample_FULL_Entry_Order.xml"; - - public const string HashSimpleXML = "U2zic7KOnKw60rzh+KKQ1lwZL6NmXju+DXG7cYYmlxo="; - public const string HashEngineXML = "cfPKB2LkHIbznFA9aQwCNfNLSj9V7qNnSskyOxaXB+o="; - public const string HashVehicleXML = "yZCH9sF1GUdawVOa1fKQ2zvuUHg5ZthmitTOcWg/s1Y="; - - [TestMethod] - public void HashSimpleXml() - { - var elementToHash = "elemID"; - var doc = new XmlDocument(); - doc.Load(SimpleXML); - var hasher = new XMLHashProvider(); - var hashed = XMLHashProvider.ComputeHash(doc, elementToHash); - - var hash = GetHashValue(hashed, elementToHash); - WriteSignedXML(doc, "simple_document_hashed.xml"); - - - Assert.AreEqual(HashSimpleXML, hash); - } - - [TestMethod] - public void HashReferenceEngineXML() - { - var elementToHash = "ENG-gooZah3D"; - var doc = new XmlDocument(); - doc.Load(ReferenceXMLEngine); - var hasher = new XMLHashProvider(); - var hashed = XMLHashProvider.ComputeHash(doc, elementToHash); - - var hash = GetHashValue(hashed, elementToHash); - WriteSignedXML(doc, "reference_engine_hashed.xml"); - - - Assert.AreEqual(HashEngineXML, hash); - } - - [TestMethod] - public void HashReferenceVehicleXML() - { - var elementToHash = "VEH-1234567890"; - var doc = new XmlDocument(); - doc.Load(ReferenceXMLVehicle); - var hasher = new XMLHashProvider(); - var hashed = XMLHashProvider.ComputeHash(doc, elementToHash); - - var hash = GetHashValue(hashed, elementToHash); - WriteSignedXML(doc, "reference_vehicle_hashed.xml"); - - - Assert.AreEqual(HashVehicleXML, hash); - } - - [TestMethod] - public void HashUnorderedVehicleXML() - { - var elementToHash = "VEH-1234567890"; - var doc = new XmlDocument(); - doc.Load(UnorderedXMLVehicle); - var hasher = new XMLHashProvider(); - var hashed = XMLHashProvider.ComputeHash(doc, elementToHash); - - var hash = GetHashValue(hashed, elementToHash); - WriteSignedXML(doc, "reference_vehicle_hashed.xml"); - - - Assert.AreEqual(HashVehicleXML, hash); - } - - private static string GetHashValue(XmlDocument hashed, string elementToHash) - { - var xdoc = hashed.ToXDocument(); - var hash = xdoc.XPathSelectElement("//*[@URI='#" + elementToHash + "']/*[local-name() = 'DigestValue']").Value; - return hash; - } - - private static void WriteSignedXML(XmlDocument doc, string filename) - { - var xmltw = new XmlTextWriter(filename, new UTF8Encoding(false)); - doc.WriteTo(xmltw); - xmltw.Close(); - } - } -} \ No newline at end of file +using System.IO; +using System.Text; +using System.Xml; +using System.Xml.XPath; +using TUGraz.VectoHashing.Impl; +using TUGraz.VectoHashing.Util; +using NUnit.Framework; + +namespace VectoHashingTest +{ + [TestFixture] + public class BasicHasingTests + { + public const string SimpleXML = @"Testdata\XML\simple_document.xml"; + public const string ReferenceXMLEngine = @"Testdata\XML\Reference\vecto_engine-sample.xml"; + public const string ReferenceXMLVehicle = @"Testdata\XML\Reference\vecto_vehicle-sample_FULL.xml"; + + public const string UnorderedXMLVehicle = @"Testdata\XML\Variations\vecto_vehicle-sample_FULL_Entry_Order.xml"; + + public const string HashSimpleXML = "U2zic7KOnKw60rzh+KKQ1lwZL6NmXju+DXG7cYYmlxo="; + public const string HashEngineXML = "cfPKB2LkHIbznFA9aQwCNfNLSj9V7qNnSskyOxaXB+o="; + public const string HashVehicleXML = "yZCH9sF1GUdawVOa1fKQ2zvuUHg5ZthmitTOcWg/s1Y="; + + [OneTimeSetUp] + public void RunBeforeAnyTests() + { + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); + } + + [TestCase] + public void HashSimpleXml() + { + var elementToHash = "elemID"; + var doc = new XmlDocument(); + doc.Load(SimpleXML); + var hasher = new XMLHashProvider(); + var hashed = XMLHashProvider.ComputeHash(doc, elementToHash); + + var hash = GetHashValue(hashed, elementToHash); + WriteSignedXML(doc, "simple_document_hashed.xml"); + + + Assert.AreEqual(HashSimpleXML, hash); + } + + [TestCase] + public void HashReferenceEngineXML() + { + var elementToHash = "ENG-gooZah3D"; + var doc = new XmlDocument(); + doc.Load(ReferenceXMLEngine); + var hasher = new XMLHashProvider(); + var hashed = XMLHashProvider.ComputeHash(doc, elementToHash); + + var hash = GetHashValue(hashed, elementToHash); + WriteSignedXML(doc, "reference_engine_hashed.xml"); + + + Assert.AreEqual(HashEngineXML, hash); + } + + [TestCase] + public void HashReferenceVehicleXML() + { + var elementToHash = "VEH-1234567890"; + var doc = new XmlDocument(); + doc.Load(ReferenceXMLVehicle); + var hasher = new XMLHashProvider(); + var hashed = XMLHashProvider.ComputeHash(doc, elementToHash); + + var hash = GetHashValue(hashed, elementToHash); + WriteSignedXML(doc, "reference_vehicle_hashed.xml"); + + + Assert.AreEqual(HashVehicleXML, hash); + } + + [TestCase] + public void HashUnorderedVehicleXML() + { + var elementToHash = "VEH-1234567890"; + var doc = new XmlDocument(); + doc.Load(UnorderedXMLVehicle); + var hasher = new XMLHashProvider(); + var hashed = XMLHashProvider.ComputeHash(doc, elementToHash); + + var hash = GetHashValue(hashed, elementToHash); + WriteSignedXML(doc, "reference_vehicle_hashed.xml"); + + + Assert.AreEqual(HashVehicleXML, hash); + } + + private static string GetHashValue(XmlDocument hashed, string elementToHash) + { + var xdoc = hashed.ToXDocument(); + var hash = xdoc.XPathSelectElement("//*[@URI='#" + elementToHash + "']/*[local-name() = 'DigestValue']").Value; + return hash; + } + + private static void WriteSignedXML(XmlDocument doc, string filename) + { + var xmltw = new XmlTextWriter(filename, new UTF8Encoding(false)); + doc.WriteTo(xmltw); + xmltw.Close(); + } + } +} diff --git a/VectoCore/VectoCoreTest/Dummy/EngineFLDTest.cs b/VectoCore/VectoCoreTest/Dummy/EngineFLDTest.cs index f2f69a3934ed59f3c61a258528b3c76426379b77..0aac78c9272e573c5c12e3c3768ba5de8b21b37c 100644 --- a/VectoCore/VectoCoreTest/Dummy/EngineFLDTest.cs +++ b/VectoCore/VectoCoreTest/Dummy/EngineFLDTest.cs @@ -1,98 +1,97 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2017 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Diagnostics; -using System.IO; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.InputData.Reader; -using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; - -namespace TUGraz.VectoCore.Tests.Dummy -{ - [TestClass] - public class EngineFLDTest - { - [TestMethod] - public void CompareFLDLookupPerformance() - { - var engineFile1 = @"TestData\Components\40t_Long_Haul_Truck.vfld"; - var engineFile2 = @"E:\QUAM\Downloads\EngineFLD\Map_375c_BB1390_modTUG_R49_375c_BB1386.vfld"; - - if (!File.Exists(engineFile2)) { - Assert.Inconclusive("Confidential File not found. Test cannot run without file."); - } - - var map1 = FullLoadCurveReader.ReadFromFile(engineFile1, true); - var map2 = FullLoadCurveReader.ReadFromFile(engineFile2, true); - - map1.FullLoadStationaryTorque(1000.RPMtoRad()); - map2.FullLoadStationaryTorque(1000.RPMtoRad()); - - foreach (var map in new[] { map1, map2 }) { - var rand = new Random(); - var stopWatch = Stopwatch.StartNew(); - - - for (var i = 0; i < 500000; i++) { - var angularVelocity = rand.Next(1000, 1400).RPMtoRad(); - - var tqMax = map.FullLoadStationaryTorque(angularVelocity); - } - - stopWatch.Stop(); - Debug.Print("{0}", stopWatch.ElapsedMilliseconds); - } - } - - [TestMethod] - public void LookupTest() - { - var engineFile2 = @"E:\QUAM\Downloads\EngineFLD\Map_375c_BB1390_modTUG_R49_375c_BB1386.vfld"; - - if (!File.Exists(engineFile2)) { - Assert.Inconclusive("Confidential File not found. Test cannot run without file."); - } - - var map = FullLoadCurveReader.ReadFromFile(engineFile2, true); - - Assert.AreEqual(1208, map.FullLoadStationaryTorque(500.RPMtoRad()).Value(), 1e-3); - - Assert.AreEqual(27, map.FullLoadStationaryTorque(2202.RPMtoRad()).Value(), 1e-3); - - Assert.AreEqual(2341.5714, map.FullLoadStationaryTorque(1500.RPMtoRad()).Value(), 1e-3); - Assert.AreEqual(376.7142, map.FullLoadStationaryTorque(2175.RPMtoRad()).Value(), 1e-3); - - Assert.AreEqual(1544, map.FullLoadStationaryTorque(628.RPMtoRad()).Value(), 1e-3); - } - } -} +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Diagnostics; +using System.IO; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader; +using NUnit.Framework; + +namespace TUGraz.VectoCore.Tests.Dummy +{ + [TestFixture] + public class EngineFLDTest + { + [TestCase] + public void CompareFLDLookupPerformance() + { + var engineFile1 = @"TestData\Components\40t_Long_Haul_Truck.vfld"; + var engineFile2 = @"E:\QUAM\Downloads\EngineFLD\Map_375c_BB1390_modTUG_R49_375c_BB1386.vfld"; + + if (!File.Exists(engineFile2)) { + Assert.Inconclusive("Confidential File not found. Test cannot run without file."); + } + + var map1 = FullLoadCurveReader.ReadFromFile(engineFile1, true); + var map2 = FullLoadCurveReader.ReadFromFile(engineFile2, true); + + map1.FullLoadStationaryTorque(1000.RPMtoRad()); + map2.FullLoadStationaryTorque(1000.RPMtoRad()); + + foreach (var map in new[] { map1, map2 }) { + var rand = new Random(); + var stopWatch = Stopwatch.StartNew(); + + + for (var i = 0; i < 500000; i++) { + var angularVelocity = rand.Next(1000, 1400).RPMtoRad(); + + var tqMax = map.FullLoadStationaryTorque(angularVelocity); + } + + stopWatch.Stop(); + Debug.Print("{0}", stopWatch.ElapsedMilliseconds); + } + } + + [TestCase] + public void LookupTest() + { + var engineFile2 = @"E:\QUAM\Downloads\EngineFLD\Map_375c_BB1390_modTUG_R49_375c_BB1386.vfld"; + + if (!File.Exists(engineFile2)) { + Assert.Inconclusive("Confidential File not found. Test cannot run without file."); + } + + var map = FullLoadCurveReader.ReadFromFile(engineFile2, true); + + Assert.AreEqual(1208, map.FullLoadStationaryTorque(500.RPMtoRad()).Value(), 1e-3); + + Assert.AreEqual(27, map.FullLoadStationaryTorque(2202.RPMtoRad()).Value(), 1e-3); + + Assert.AreEqual(2341.5714, map.FullLoadStationaryTorque(1500.RPMtoRad()).Value(), 1e-3); + Assert.AreEqual(376.7142, map.FullLoadStationaryTorque(2175.RPMtoRad()).Value(), 1e-3); + + Assert.AreEqual(1544, map.FullLoadStationaryTorque(628.RPMtoRad()).Value(), 1e-3); + } + } +} diff --git a/VectoCore/VectoCoreTest/Exceptions/ExceptionTests.cs b/VectoCore/VectoCoreTest/Exceptions/ExceptionTests.cs index a5996cb9c45ce3c60f309677ef5a4cf0a61e1a53..55d5208a0a738c930c313b0edd7a87df900fd4dd 100644 --- a/VectoCore/VectoCoreTest/Exceptions/ExceptionTests.cs +++ b/VectoCore/VectoCoreTest/Exceptions/ExceptionTests.cs @@ -30,17 +30,17 @@ */ using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Exceptions; +using NUnit.Framework; // ReSharper disable ObjectCreationAsStatement namespace TUGraz.VectoCore.Tests.Exceptions { - [TestClass] + [TestFixture] public class ExceptionTests { - [TestMethod] + [TestCase] public void Test_VectoExceptions() { new CSVReadException("Test"); diff --git a/VectoCore/VectoCoreTest/FileIO/JsonTest.cs b/VectoCore/VectoCoreTest/FileIO/JsonTest.cs index c33efbd250ff758d48976aeeab3d394d1e937870..e2db15d94a580a67758bed1824e69380bfa98c80 100644 --- a/VectoCore/VectoCoreTest/FileIO/JsonTest.cs +++ b/VectoCore/VectoCoreTest/FileIO/JsonTest.cs @@ -29,9 +29,9 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using NUnit.Framework; using System.IO; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.InputData; @@ -43,13 +43,13 @@ using TUGraz.VectoCore.Tests.Utils; namespace TUGraz.VectoCore.Tests.FileIO { - [TestClass] + [TestFixture] public class JsonTest { private const string TestJobFile = @"Testdata\Jobs\40t_Long_Haul_Truck.vecto"; private const string TestVehicleFile = @"Testdata\Components\24t Coach.vveh"; - [TestMethod] + [TestCase] public void ReadJobTest() { var job = JSONInputDataFactory.ReadJsonJob(TestJobFile); @@ -58,7 +58,7 @@ namespace TUGraz.VectoCore.Tests.FileIO // AssertHelper.Exception<InvalidFileFormatException>(() => ); } - [TestMethod] + [TestCase] public void NoEngineFileTest() { var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile))); @@ -68,7 +68,7 @@ namespace TUGraz.VectoCore.Tests.FileIO "JobFile: Failed to read Engine file '': Key EngineFile not found"); } - [TestMethod] + [TestCase] public void NoGearboxFileTest() { var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile))); @@ -78,7 +78,7 @@ namespace TUGraz.VectoCore.Tests.FileIO "JobFile: Failed to read Gearbox file '': Key GearboxFile not found"); } - [TestMethod] + [TestCase] public void NoVehicleFileTest() { var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile))); @@ -88,7 +88,7 @@ namespace TUGraz.VectoCore.Tests.FileIO "JobFile: Failed to read Vehicle file '': Key VehicleFile not found"); } - [TestMethod] + [TestCase] public void NoCyclesTest() { var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile))); @@ -98,7 +98,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(0, tmp.Count); } - [TestMethod] + [TestCase] public void NoAuxTest() { var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile))); @@ -109,7 +109,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.IsTrue(tmp.Count == 0); } - [TestMethod] + [TestCase] public void NoDriverAccCurveTest() { var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile))); @@ -120,7 +120,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.IsNull(tmp); } - [TestMethod] + [TestCase] public void UseDeclarationDriverAccCurveTest() { var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile))); @@ -131,7 +131,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.IsNotNull(tmp); } - [TestMethod] + [TestCase] public void NoLookaheadCoastingTest() { var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile))); @@ -142,7 +142,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.IsNull(tmp); } - [TestMethod] + [TestCase] public void NoOverspeedEcoRollTest() { var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile))); @@ -153,7 +153,7 @@ namespace TUGraz.VectoCore.Tests.FileIO "Key OverSpeedEcoRoll not found"); } - [TestMethod] + [TestCase] public void ReadGearboxV5() { var inputProvider = JSONInputDataFactory.ReadGearbox(@"TestData\Components\AT_GBX\Gearbox_v5.vgbx"); @@ -178,7 +178,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.IsFalse(gbxData.Gears[3].HasTorqueConverter); } - [TestMethod] + [TestCase] public void ReadGearboxSerialTC() { var inputProvider = JSONInputDataFactory.ReadGearbox(@"TestData\Components\AT_GBX\GearboxSerial.vgbx"); @@ -205,7 +205,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(gear.Ratio, gear.TorqueConverterRatio); } - [TestMethod] + [TestCase] public void ReadGearboxPowersplitTC() { var inputProvider = JSONInputDataFactory.ReadGearbox(@"TestData\Components\AT_GBX\GearboxPowerSplit.vgbx"); @@ -231,7 +231,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(1, gbxData.Gears[1].TorqueConverterRatio); } - [TestMethod] + [TestCase] public void ReadGearboxDualTCTruck() { var inputProvider = JSONInputDataFactory.ReadGearbox(@"TestData\Components\AT_GBX\GearboxSerialDualTC.vgbx"); @@ -259,7 +259,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(gear.Ratio, gear.TorqueConverterRatio); } - [TestMethod] + [TestCase] public void ReadGearboxSingleTCBus() { var inputProvider = JSONInputDataFactory.ReadGearbox(@"TestData\Components\AT_GBX\GearboxSerialDualTC.vgbx"); @@ -287,7 +287,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(gear.Ratio, gear.TorqueConverterRatio); } - [TestMethod] + [TestCase] public void ReadGearboxDualTCBus() { var inputProvider = JSONInputDataFactory.ReadGearbox(@"TestData\Components\AT_GBX\GearboxSerialDualTCBus.vgbx"); @@ -315,7 +315,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(gear.Ratio, gear.TorqueConverterRatio); } - //[TestMethod] + //[TestCase] //public void TestReadingElectricTechlist() //{ // var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestJobFile))); @@ -330,7 +330,7 @@ namespace TUGraz.VectoCore.Tests.FileIO // } //} - [TestMethod] + [TestCase] public void JSON_Read_AngleGear() { var json = (JObject)JToken.ReadFrom(new JsonTextReader(File.OpenText(TestVehicleFile))); @@ -343,7 +343,7 @@ namespace TUGraz.VectoCore.Tests.FileIO } } - // [TestClass] + // [TestFixture] // public class JsonTest // { // private const string jsonExpected = @"{ @@ -360,7 +360,7 @@ namespace TUGraz.VectoCore.Tests.FileIO // ""FileVersion"": 7 //}"; - // [TestMethod] + // [TestCase] // public void TestJsonHeaderEquality() // { // var h1 = new JsonDataHeader { @@ -381,7 +381,7 @@ namespace TUGraz.VectoCore.Tests.FileIO // Assert.AreNotEqual(h1, "hello world"); // } - // [TestMethod] + // [TestCase] // public void Test_Json_DateFormat_German() // { // var json = @"{ @@ -401,7 +401,7 @@ namespace TUGraz.VectoCore.Tests.FileIO // Assert.AreEqual(jsonExpected, jsonCompare); // } - // [TestMethod] + // [TestCase] // public void Test_Json_DateFormat_German2() // { // var json = @"{ @@ -421,7 +421,7 @@ namespace TUGraz.VectoCore.Tests.FileIO // Assert.AreEqual(jsonExpected2, jsonCompare); // } - // [TestMethod] + // [TestCase] // public void Test_Json_DateFormat_English() // { // var json = @"{ @@ -441,7 +441,7 @@ namespace TUGraz.VectoCore.Tests.FileIO // Assert.AreEqual(jsonExpected, jsonCompare); // } - // [TestMethod] + // [TestCase] // public void Test_Json_DateFormat_English2() // { // var json = @"{ @@ -461,7 +461,7 @@ namespace TUGraz.VectoCore.Tests.FileIO // Assert.AreEqual(jsonExpected2, jsonCompare); // } - // [TestMethod] + // [TestCase] // public void Test_Json_DateFormat_ISO8601() // { // var json = @"{ @@ -481,7 +481,7 @@ namespace TUGraz.VectoCore.Tests.FileIO // Assert.AreEqual(json, jsonCompare); // } - // [TestMethod] + // [TestCase] // public void Test_Json_DateFormat_ISO8601_CET() // { // var json = @"{ diff --git a/VectoCore/VectoCoreTest/FileIO/SimulationDataReaderTest.cs b/VectoCore/VectoCoreTest/FileIO/SimulationDataReaderTest.cs index 58b6bb1a7441e26a75dcb3278aa4f9e72965eba7..45e3f7f00efab74b5f146d206a28584d1ef83a84 100644 --- a/VectoCore/VectoCoreTest/FileIO/SimulationDataReaderTest.cs +++ b/VectoCore/VectoCoreTest/FileIO/SimulationDataReaderTest.cs @@ -1,35 +1,35 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2017 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using NUnit.Framework; using System.IO; using System.Linq; using TUGraz.VectoCommon.Exceptions; @@ -44,13 +44,13 @@ using TUGraz.VectoCore.Tests.Utils; namespace TUGraz.VectoCore.Tests.FileIO { - [TestClass] + [TestFixture] public class SimulationDataReaderTest { protected const string DeclarationJob = @"TestData\Jobs\12t Delivery Truck.vecto"; protected const double Tolerance = 0.0001; - [TestMethod] + [TestCase] public void ReadDeclarationJobFile() { var dataProvider = JSONInputDataFactory.ReadJsonJob(DeclarationJob); diff --git a/VectoCore/VectoCoreTest/Integration/FullCycleDeclarationTest.cs b/VectoCore/VectoCoreTest/Integration/FullCycleDeclarationTest.cs index 52eae98fd9dd02a00043d9c243c4a60d825dc2de..601b05a822bb74960cec0b5cf8c3bc541f161eaa 100644 --- a/VectoCore/VectoCoreTest/Integration/FullCycleDeclarationTest.cs +++ b/VectoCore/VectoCoreTest/Integration/FullCycleDeclarationTest.cs @@ -32,7 +32,6 @@ using System.Data; using System.IO; using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.FileIO.JSON; @@ -42,10 +41,11 @@ using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.Tests.Utils; using TUGraz.VectoCore.Utils; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.Integration { - [TestClass] + [TestFixture] public class FullCycleDeclarationTest { public const string LongHaulTruckDeclarationJob = @@ -61,7 +61,7 @@ namespace TUGraz.VectoCore.Tests.Integration @"TestData\Integration\DeclarationMode\Class9_RigidTruck_6x2\Class9_RigidTruck_DECL.vecto"; - [TestMethod] + [TestCase] public void Truck40t_LongHaulCycle_RefLoad() { var cycle = SimpleDrivingCycles.ReadDeclarationCycle("LongHaul"); @@ -72,7 +72,7 @@ namespace TUGraz.VectoCore.Tests.Integration Assert.IsTrue(run.FinishedWithoutErrors); } - [TestMethod] + [TestCase] public void Truck40t_RegionalDeliveryCycle_RefLoad() { var cycle = SimpleDrivingCycles.ReadDeclarationCycle("RegionalDelivery"); @@ -83,7 +83,7 @@ namespace TUGraz.VectoCore.Tests.Integration Assert.IsTrue(run.FinishedWithoutErrors); } - [TestMethod] + [TestCase] public void Truck40t_UrbanDeliveryCycle_RefLoad() { var cycle = SimpleDrivingCycles.ReadDeclarationCycle("UrbanDelivery"); @@ -94,7 +94,7 @@ namespace TUGraz.VectoCore.Tests.Integration Assert.IsTrue(run.FinishedWithoutErrors); } - [TestMethod] + [TestCase] public void Truck40t_MunicipalCycle_RefLoad() { var cycle = SimpleDrivingCycles.ReadDeclarationCycle("MunicipalUtility"); @@ -105,7 +105,7 @@ namespace TUGraz.VectoCore.Tests.Integration Assert.IsTrue(run.FinishedWithoutErrors); } - [TestMethod] + [TestCase] public void Truck40t_ConstructionCycle_RefLoad() { var cycle = SimpleDrivingCycles.ReadDeclarationCycle("Construction"); @@ -116,7 +116,7 @@ namespace TUGraz.VectoCore.Tests.Integration Assert.IsTrue(run.FinishedWithoutErrors); } - [TestMethod] + [TestCase] public void Truck40t_HeavyUrbanCycle_RefLoad() { var cycle = SimpleDrivingCycles.ReadDeclarationCycle("HeavyUrban"); @@ -128,7 +128,7 @@ namespace TUGraz.VectoCore.Tests.Integration Assert.IsTrue(run.FinishedWithoutErrors); } - [TestMethod] + [TestCase] public void Truck40t_SubUrbanCycle_RefLoad() { var cycle = SimpleDrivingCycles.ReadDeclarationCycle("Suburban"); @@ -139,7 +139,7 @@ namespace TUGraz.VectoCore.Tests.Integration Assert.IsTrue(run.FinishedWithoutErrors); } - [TestMethod, TestCategory("LongRunning")] + [TestCase, Category("LongRunning")] public void Truck40t_InterUrbanCycle_RefLoad() { var cycle = SimpleDrivingCycles.ReadDeclarationCycle("Interurban"); @@ -150,7 +150,7 @@ namespace TUGraz.VectoCore.Tests.Integration Assert.IsTrue(run.FinishedWithoutErrors); } - [TestMethod, TestCategory("LongRunning")] + [TestCase, Category("LongRunning")] public void Truck40t_CoachCycle_RefLoad() { var cycle = SimpleDrivingCycles.ReadDeclarationCycle("Coach"); @@ -162,7 +162,7 @@ namespace TUGraz.VectoCore.Tests.Integration Assert.IsTrue(run.FinishedWithoutErrors); } - [TestMethod, TestCategory("LongRunning")] + [TestCase, Category("LongRunning")] public void Truck40t_DeclarationTest() { var inputData = JSONInputDataFactory.ReadJsonJob(LongHaulTruckDeclarationJob); @@ -185,7 +185,7 @@ namespace TUGraz.VectoCore.Tests.Integration Assert.IsTrue(jobContainer.Runs.All(r => r.Success), string.Concat(jobContainer.Runs.Select(r => r.ExecException))); } - [TestMethod, TestCategory("LongRunning")] + [TestCase, Category("LongRunning")] public void Truck40t_Mod1Hz_Test() { var modFileName = "40t_Long_Haul_Truck_RegionalDeliveryReferenceLoad.vmod"; @@ -281,7 +281,7 @@ namespace TUGraz.VectoCore.Tests.Integration AssertHelper.AreRelativeEqual(vAct, vAct1Hz, 1e-4, "end velocity is not equal"); } - [TestMethod, TestCategory("LongRunning")] + [TestCase, Category("LongRunning")] public void Truck12t_DeclarationTest() { var inputData = JSONInputDataFactory.ReadJsonJob(DeliveryTruckDeclarationJob); @@ -313,7 +313,7 @@ namespace TUGraz.VectoCore.Tests.Integration string.Concat(jobContainer.Runs.Select(r => r.ExecException)))); } - [TestMethod, TestCategory("LongRunning")] + [TestCase, Category("LongRunning")] public void Truck12t8Gear_DeclarationTest() { var inputData = JSONInputDataFactory.ReadJsonJob(DeliveryTruck8GearDeclarationJob); @@ -337,7 +337,7 @@ namespace TUGraz.VectoCore.Tests.Integration } - [TestMethod] + [TestCase] public void DeclarationClass9PTOTest() { var inputData = JSONInputDataFactory.ReadJsonJob(Class9RigidTruckPTOJob); diff --git a/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs b/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs index a8c325b978b7d54b7252614ebd8cf23662f5ed2a..ec9121a26a12ef3781b4a04459890b9ca008c35b 100644 --- a/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs @@ -32,7 +32,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; @@ -51,10 +50,11 @@ using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.Tests.Utils; using TUGraz.VectoCore.Utils; using Wheels = TUGraz.VectoCore.Models.SimulationComponent.Impl.Wheels; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns { - [TestClass] + [TestFixture] public class FullPowerTrain { public const string CycleFile = @"TestData\Integration\FullPowerTrain\1-Gear-Test-dist.vdri"; @@ -67,7 +67,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns //public const string GearboxFullLoadCurveFile = @"TestData\Components\Gearbox.vfld"; private static readonly LoggingObject Log = LogManager.GetLogger(typeof(FullPowerTrain).ToString()); - [TestMethod, TestCategory("LongRunning")] + [TestCase, Category("LongRunning")] public void Test_FullPowertrain_SimpleGearbox() { var fileWriter = new FileOutputWriter("Coach_FullPowertrain_SimpleGearbox"); @@ -129,10 +129,10 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns Default(r => Assert.Fail("Unexpected Response: {0}", r)); } while (!(response is ResponseCycleFinished)); modData.Finish(VectoRun.Status.Success); - Assert.IsInstanceOfType(response, typeof(ResponseCycleFinished)); + Assert.IsInstanceOf<ResponseCycleFinished>(response); } - [TestMethod] + [TestCase] public void Test_FullPowertrain() { var fileWriter = new FileOutputWriter("Coach_FullPowertrain"); @@ -174,7 +174,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns var absTime = 0.SI<Second>(); var ds = Constants.SimulationSettings.DriveOffDistance; var response = cyclePort.Request(absTime, ds); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); container.CommitSimulationStep(absTime, response.SimulationInterval); absTime += response.SimulationInterval; @@ -209,10 +209,10 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns Default(r => Assert.Fail("Unexpected Response: {0}", r)); } modData.Finish(VectoRun.Status.Success); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); } - [TestMethod, TestCategory("LongRunning")] + [TestCase, Category("LongRunning")] public void Test_FullPowertrain_LowSpeed() { var fileWriter = new FileOutputWriter("Coach_FullPowertrain_LowSpeed"); @@ -252,7 +252,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns var absTime = 0.SI<Second>(); var ds = Constants.SimulationSettings.DriveOffDistance; var response = cyclePort.Request(absTime, ds); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); container.CommitSimulationStep(absTime, response.SimulationInterval); absTime += response.SimulationInterval; @@ -290,10 +290,10 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns }); } modData.Finish(VectoRun.Status.Success); - Assert.IsInstanceOfType(response, typeof(ResponseCycleFinished)); + Assert.IsInstanceOf<ResponseCycleFinished>(response); } - [TestMethod] + [TestCase] public void Test_FullPowerTrain_JobFile() { const string jobFile = @"TestData\job.vecto"; diff --git a/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs b/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs index f08f921cafc0452b7280b181b7a926b0ae44c215..0ac48c53d4308bb3d3188ae33ec7aeddfc6b830e 100644 --- a/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs @@ -30,7 +30,6 @@ */ using System.Collections.Generic; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; @@ -48,10 +47,11 @@ using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.Tests.Utils; using TUGraz.VectoCore.Utils; using Wheels = TUGraz.VectoCore.Models.SimulationComponent.Impl.Wheels; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns { - [TestClass] + [TestFixture] public class MinimalPowertrain { public const string CycleFile = @"TestData\Integration\MinimalPowerTrain\1-Gear-Test-dist.vdri"; @@ -63,7 +63,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns public const string AccelerationFile2 = @"TestData\Components\Truck.vacc"; public const double Tolerance = 0.001; - [TestMethod] + [TestCase] public void TestWheelsAndEngineInitialize() { var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile, 1); @@ -95,7 +95,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns var response = driverPort.Initialize(18.KMPHtoMeterPerSecond(), VectoMath.InclinationToAngle(2.842372037 / 100)); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); // time [s] , dist [m] , v_act [km/h] , v_targ [km/h] , acc [m/s²] , grad [%] , n_eng_avg [1/min] , T_eng_fcmap [Nm] , Tq_clutch [Nm] , Tq_full [Nm] , Tq_drag [Nm] , P_eng_out [kW] , P_eng_full [kW] , P_eng_drag [kW] , P_clutch_out [kW] , Pa Eng [kW] , P_aux [kW] , Gear [-] , Ploss GB [kW] , Ploss Diff [kW] , Ploss Retarder [kW] , Pa GB [kW] , Pa Veh [kW] , P_roll [kW] , P_air [kW] , P_slope [kW] , P_wheel_in [kW] , P_brake_loss [kW] , FC-Map [g/h] , FC-AUXc [g/h] , FC-WHTCc [g/h] // 1.5 , 5 , 18 , 18 , 0 , 2.842372 , 964.1117 , 323.7562 , 323.7562 , 2208.664 , -158.0261 , 32.68693 , 222.9902 , -15.95456 , 32.68693 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 5.965827 , 0.2423075 , 26.47879 , 32.68693 , 0 , 7574.113 , - , - @@ -107,7 +107,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns Assert.AreEqual(323.6485, engine.PreviousState.EngineTorque.Value(), Tolerance); } - [TestMethod, TestCategory("LongRunning")] + [TestCase, Category("LongRunning")] public void TestWheelsAndEngine() { NLog.LogManager.DisableLogging(); @@ -146,7 +146,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns var absTime = 0.SI<Second>(); var ds = Constants.SimulationSettings.DriveOffDistance; var response = cyclePort.Request(absTime, ds); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); container.CommitSimulationStep(absTime, response.SimulationInterval); absTime += response.SimulationInterval; @@ -173,14 +173,14 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns Default(r => Assert.Fail("Unexpected Response: {0}", r)); } - Assert.IsInstanceOfType(response, typeof(ResponseCycleFinished)); + Assert.IsInstanceOf<ResponseSuccess>(response); modData.Finish(VectoRun.Status.Success); NLog.LogManager.EnableLogging(); } - [TestMethod] + [TestCase] public void TestWheelsAndEngineLookahead() { var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile, 1); diff --git a/VectoCore/VectoCoreTest/Integration/TestVehicleIdlingSpeed.cs b/VectoCore/VectoCoreTest/Integration/TestVehicleIdlingSpeed.cs index 9064af1ace2c46e4b6fa88ade1c48fb1bad020f3..3dc0df672d91c3024b8a9efb9fe294a2172d8a75 100644 --- a/VectoCore/VectoCoreTest/Integration/TestVehicleIdlingSpeed.cs +++ b/VectoCore/VectoCoreTest/Integration/TestVehicleIdlingSpeed.cs @@ -1,37 +1,36 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2017 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; using System.Xml; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Utils; @@ -42,15 +41,16 @@ using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.Utils; - +using NUnit.Framework; + namespace TUGraz.VectoCore.Tests.Integration { - [TestClass] + [TestFixture] public class TestVehicleIdlingSpeed { const string SampleVehicleDecl = "TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample.xml"; - [TestMethod, TestCategory("LongRunning")] + [TestCase, Category("LongRunning")] public void VehicleIdlingSpeedTest() { var VehicleEngineIdleSpeed = 900.RPMtoRad(); diff --git a/VectoCore/VectoCoreTest/Models/Declaration/AirdragDefaultValuesTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/AirdragDefaultValuesTest.cs index 586dbfe8d0d5aa9618c6a471918be72f99af9eda..213bda560cbdd6f8ff3bd51b907f9c90703428af 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/AirdragDefaultValuesTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/AirdragDefaultValuesTest.cs @@ -1,47 +1,46 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2017 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.InputData; using TUGraz.VectoCore.InputData.FileIO.JSON; using TUGraz.VectoCore.InputData.Reader.Impl; using TUGraz.VectoCore.Tests.Models.Declaration.DataAdapter; - +using NUnit.Framework; + namespace TUGraz.VectoCore.Tests.Models.Declaration { - [TestClass] + [TestFixture] public class AirdragDefaultValuesTest { - [TestMethod] + [TestCase] public void TestClass2() { var file = @"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto"; @@ -57,7 +56,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration Assert.AreEqual(7.2, runData[0].AirdragData.DeclaredAirdragArea.Value()); } - [TestMethod] + [TestCase] public void TestClass5() { var file = @"TestData\Integration\DeclarationMode\Class5_Tractor_4x2\Class5_Tractor_DECL.vecto"; @@ -72,7 +71,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration Assert.AreEqual(8.7, runData[0].AirdragData.DeclaredAirdragArea.Value()); } - [TestMethod] + [TestCase] public void TestClass9() { var file = @"TestData\Integration\DeclarationMode\Class9_RigidTruck_6x2\Class9_RigidTruck_DECL.vecto"; diff --git a/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs index 9ed4db1a20e1c62d758f7ba12878a87896ef56fb..2e4233ba6d566198215d3ba401d2c19e3f1e5975 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs @@ -49,15 +49,16 @@ using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.Tests.Models.SimulationComponent; using TUGraz.VectoCore.Tests.Utils; +using NUnit.Framework; // ReSharper disable ObjectCreationAsStatement namespace TUGraz.VectoCore.Tests.Models.Simulation { - [TestClass] + [TestFixture] public class AuxTests { - [TestMethod] + [TestCase] public void AuxWriteModFileSumFile() { @@ -120,7 +121,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"AuxWriteModFileSumFile.vsum"); } - [TestMethod] + [TestCase] public void AuxConstant() { var dataWriter = new MockModalDataContainer(); @@ -152,7 +153,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation AssertHelper.AreRelativeEqual(constPower / speed, auxDemand); } - [TestMethod] + [TestCase] public void AuxDirect() { var dataWriter = new MockModalDataContainer(); @@ -181,7 +182,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation } } - [TestMethod] + [TestCase] public void AuxAllCombined() { var dataWriter = new MockModalDataContainer(); @@ -246,7 +247,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation } } - [TestMethod] + [TestCase] public void AuxMapping() { var auxId = "ALT1"; @@ -307,7 +308,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation } } - [TestMethod] + [TestCase] public void AuxColumnMissing() { var container = new VehicleContainer(ExecutionMode.Engineering); @@ -320,7 +321,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation "driving cycle does not contain column for auxiliary: AUX_NONEXISTING_AUX"); } - [TestMethod] + [TestCase] public void AuxFileMissing() { AssertHelper.Exception<VectoException>(() => { @@ -329,7 +330,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation }, "Auxiliary file not found: NOT_EXISTING_AUX_FILE.vaux"); } - [TestMethod] + [TestCase] public void AuxReadJobFileDeclarationMode() { var fileWriter = new FileOutputWriter("AuxReadJobFileDeclarationMode"); @@ -343,7 +344,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation jobContainer.AddRuns(runsFactory); } - [TestMethod] + [TestCase] public void AuxReadJobFileEngineeringMode() { var fileWriter = new FileOutputWriter("AuxReadJobFileEngineeringMode"); @@ -357,7 +358,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation jobContainer.AddRuns(runsFactory); } - [TestMethod] + [TestCase] public void AuxDeclarationWrongConfiguration() { var fileWriter = new FileOutputWriter("AuxReadJobFileDeclarationMode"); diff --git a/VectoCore/VectoCoreTest/Models/Simulation/FactoryTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/FactoryTest.cs index 7f29f6e73e9d6c4311e14d4f61464388ac2229d4..0ae685d848ddb77794592885c3bd5eb7849c77cc 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/FactoryTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/FactoryTest.cs @@ -30,24 +30,24 @@ */ using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.FileIO.JSON; using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.SimulationComponent.Impl; using TUGraz.VectoCore.OutputData.FileIO; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.Models.Simulation { - [TestClass] + [TestFixture] public class FactoryTest { public const string DeclarationJobFile = @"Testdata\Jobs\12t Delivery Truck.vecto"; public const string EngineeringJobFile = @"Testdata\Jobs\24t Coach.vecto"; - [TestMethod] + [TestCase] public void CreateDeclarationSimulationRun() { var fileWriter = new FileOutputWriter(DeclarationJobFile); @@ -62,9 +62,9 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation Assert.AreEqual(11, vehicleContainer.SimulationComponents().Count); - Assert.IsInstanceOfType(vehicleContainer.Gearbox, typeof(Gearbox), "gearbox not installed"); - Assert.IsInstanceOfType(vehicleContainer.Engine, typeof(CombustionEngine), "engine not installed"); - Assert.IsInstanceOfType(vehicleContainer.Vehicle, typeof(Vehicle), "vehicle not installed"); + Assert.IsInstanceOf<Gearbox>(vehicleContainer.Gearbox, "gearbox not installed"); + Assert.IsInstanceOf<CombustionEngine>(vehicleContainer.Engine, "engine not installed"); + Assert.IsInstanceOf<Vehicle>(vehicleContainer.Vehicle, "vehicle not installed"); var gearbox = vehicleContainer.Gearbox as Gearbox; Assert.IsNotNull(gearbox); @@ -102,7 +102,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation Assert.AreEqual(988.9, gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[2].Torque.Value(), 0.1); } - [TestMethod] + [TestCase] public void CreateEngineeringSimulationRun() { var fileWriter = new FileOutputWriter(EngineeringJobFile); @@ -115,9 +115,9 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation var vehicleContainer = (VehicleContainer)run.GetContainer(); Assert.AreEqual(12, vehicleContainer.SimulationComponents().Count); - Assert.IsInstanceOfType(vehicleContainer.Gearbox, typeof(Gearbox), "gearbox not installed"); - Assert.IsInstanceOfType(vehicleContainer.Engine, typeof(CombustionEngine), "engine not installed"); - Assert.IsInstanceOfType(vehicleContainer.Vehicle, typeof(Vehicle), "vehicle not installed"); + Assert.IsInstanceOf<Gearbox>(vehicleContainer.Gearbox, "gearbox not installed"); + Assert.IsInstanceOf<CombustionEngine>(vehicleContainer.Engine, "engine not installed"); + Assert.IsInstanceOf<Vehicle>(vehicleContainer.Vehicle, "vehicle not installed"); } } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/Simulation/LACDecisionFactorTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/LACDecisionFactorTest.cs index 17e5101ae737e34ded3f5a0ca61d95270887762d..94423d5c18078490223823eae84a6d1ec9b8d949 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/LACDecisionFactorTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/LACDecisionFactorTest.cs @@ -29,17 +29,17 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Tests.Utils; namespace TUGraz.VectoCore.Tests.Models.Simulation { - [TestClass] + [TestFixture] public class LACDecisionFactorTest { - [TestMethod] + [TestCase] public void LAC_DF_Test() { for (var vVehicle = 0.SI<MeterPerSecond>(); diff --git a/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs index 623d6a5241968ada84a5b51e226012f073cc930b..8fdbc596b6df394c5dfb2c468ccaf559e63b7c2e 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs @@ -1,35 +1,35 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2017 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using NUnit.Framework; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -50,7 +50,7 @@ using TUGraz.VectoCore.Tests.Utils; namespace TUGraz.VectoCore.Tests.Models.Simulation { - [TestClass] + [TestFixture] public class LossMapRangeValidationTest { public const string ShiftPolygonFile = @"TestData\Components\ShiftPolygons.vgbs"; @@ -66,7 +66,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// <summary> /// VECTO-173 /// </summary> - [TestMethod] + [TestCase] public void LossMapValid() { var gearboxData = CreateGearboxData(GearboxDirectLoss, GearboxIndirectLoss); @@ -103,7 +103,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// <summary> /// VECTO-173 /// </summary> - [TestMethod] + [TestCase] public void LossMapInvalidAxle() { var gearboxData = CreateGearboxData(GearboxDirectLoss, GearboxIndirectLoss); @@ -117,7 +117,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// <summary> /// VECTO-173 /// </summary> - [TestMethod] + [TestCase] public void LossMapLimited() { var gearboxData = CreateGearboxData(GearboxLimited, GearboxLimited); @@ -131,7 +131,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// <summary> /// VECTO-173 /// </summary> - [TestMethod] + [TestCase] public void LossMapAxleLossMapMissing() { var gearboxData = CreateGearboxData(GearboxDirectLoss, GearboxIndirectLoss); @@ -164,7 +164,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// <summary> /// VECTO-173 /// </summary> - [TestMethod] + [TestCase] public void LossMapGearLossMapMissing() { var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile, 0); @@ -211,7 +211,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// <summary> /// VECTO-230 /// </summary> - [TestMethod] + [TestCase] public void TestLossMapValuesWithEfficiency() { var lossMap = TransmissionLossMapReader.Create(0.95, 1.0, "Dummy"); @@ -244,7 +244,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// <summary> /// VECTO-230 /// </summary> - [TestMethod] + [TestCase] public void CreateJobWithLossMapEfficiency_Engineering() { var dataProvider = JSONInputDataFactory.ReadJsonJob(@"TestData\Jobs\12t Delivery Truck Engineering Efficiency.vecto"); @@ -256,7 +256,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// <summary> /// VECTO-230 /// </summary> - [TestMethod] + [TestCase] public void RunJobWithLossMapEfficiency_Engineering() { const string jobFileName = @"TestData\Jobs\12t Delivery Truck Engineering Efficiency.vecto"; @@ -277,7 +277,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// <summary> /// VECTO-230 /// </summary> - [TestMethod] + [TestCase] public void CreateJobWith_Axle_LossMapEfficiency_Declaration() { var dataProvider = JSONInputDataFactory.ReadJsonJob(@"TestData\Jobs\40t_Long_Haul_Truck with AxleEfficiency.vecto"); @@ -290,7 +290,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// <summary> /// VECTO-230 /// </summary> - [TestMethod] + [TestCase] public void CreateJobWith_Gear_LossMapEfficiency_Declaration() { var dataProvider = JSONInputDataFactory.ReadJsonJob(@"TestData\Jobs\40t_Long_Haul_Truck with GearEfficiency.vecto"); diff --git a/VectoCore/VectoCoreTest/Models/Simulation/MeasuredSpeedModeTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/MeasuredSpeedModeTest.cs index 841ce58b226a59918162cab3b5d49f14dde246e1..67595e7a88f655313e225e6c4a9e2a9f2043f5d0 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/MeasuredSpeedModeTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/MeasuredSpeedModeTest.cs @@ -29,7 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; using System.Collections.Generic; using System.Data; using System.Linq; @@ -57,45 +57,45 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Tests.Models.Simulation { - [TestClass] + [TestFixture] public class MeasuredSpeedModeTest { /// <summary> /// Test if the cycle file can be read. /// </summary> /// <remarks>VECTO-181</remarks> - [TestMethod] + [TestCase] public void MeasuredSpeed_ReadCycle_Gear() { // all data - var inputData = @"<t>,<v>,<grad>,<Padd>,<n> ,<gear>,<vair_res>,<vair_beta>,<Aux_Alt> + var inputData = @"<t>,<v>,<grad>,<Padd>,<n> ,<gear>,<vair_res>,<vair_beta>,<Aux_Alt> 0 ,0 ,0 ,3.2018,595.75,0 ,0 ,0 ,0.504"; TestCycleRead(inputData, CycleType.MeasuredSpeedGear); // vair only - inputData = @"<t>,<v>,<grad>,<Padd>,<n> ,<gear>,<vair_res>,<vair_beta> + inputData = @"<t>,<v>,<grad>,<Padd>,<n> ,<gear>,<vair_res>,<vair_beta> 0 ,0 ,0 ,3.2018,595.75,0 ,0 ,0 "; TestCycleRead(inputData, CycleType.MeasuredSpeedGear, crossWindRequired: true); // vair required, but not there: error - inputData = @"<t>,<v>,<grad>,<Padd>,<n> ,<gear> + inputData = @"<t>,<v>,<grad>,<Padd>,<n> ,<gear> 0 ,0 ,0 ,3.2018,595.75,0"; AssertHelper.Exception<VectoException>( () => TestCycleRead(inputData, CycleType.MeasuredSpeedGear, crossWindRequired: true), "ERROR while reading DrivingCycle Stream: Column vair_res was not found in DataRow."); // no aux, no vair - inputData = @"<t>,<v>,<grad>,<Padd>,<n> ,<gear> + inputData = @"<t>,<v>,<grad>,<Padd>,<n> ,<gear> 0 ,0 ,0 ,3.2018,595.75,0 "; TestCycleRead(inputData, CycleType.MeasuredSpeedGear); // aux only - inputData = @"<t>,<v>,<grad>,<Padd>,<n> ,<gear>,<Aux_Alt> + inputData = @"<t>,<v>,<grad>,<Padd>,<n> ,<gear>,<Aux_Alt> 0 ,0 ,0 ,3.2018,595.75,0 ,0.504"; TestCycleRead(inputData, CycleType.MeasuredSpeedGear); // missing columns - inputData = @"<t>,<grad>,<Padd>,<n>,<gear> + inputData = @"<t>,<grad>,<Padd>,<n>,<gear> 0 ,0 ,3.2018,595.75,0"; AssertHelper.Exception<VectoException>( () => TestCycleRead(inputData, CycleType.MeasuredSpeedGear, autoCycle: false), @@ -107,13 +107,13 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation "CycleFile format is unknown."); // not allowed columns - inputData = @"<t>,<v>,<grad>,<Padd>,<n> ,<gear>,<wrong> + inputData = @"<t>,<v>,<grad>,<Padd>,<n> ,<gear>,<wrong> 0 ,0 ,0 ,3.2018,595.75,0 ,0.504"; AssertHelper.Exception<VectoException>(() => TestCycleRead(inputData, CycleType.MeasuredSpeedGear, autoCycle: false), "ERROR while reading DrivingCycle Stream: Column(s) not allowed: wrong"); // wrong data - inputData = @"<t>,<grad>,<Padd>,<n>,<gear> + inputData = @"<t>,<grad>,<Padd>,<n>,<gear> 0 ,0"; AssertHelper.Exception<VectoException>(() => TestCycleRead(inputData, CycleType.MeasuredSpeedGear), "Line 1: The number of values is not correct. Expected 5 Columns, Got 2 Columns"); @@ -123,44 +123,44 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// Test if the cycle file can be read. /// </summary> /// <remarks>VECTO-181</remarks> - [TestMethod] + [TestCase] public void MeasuredSpeed_ReadCycle() { // all data - string inputData = @"<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_Alt> + string inputData = @"<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_Alt> 0 ,0 ,0 ,3.2018,0 ,0 ,0.504"; TestCycleRead(inputData, CycleType.MeasuredSpeed); // vair only - inputData = @"<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta> + inputData = @"<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta> 0 ,0 ,0 ,3.2018,0 ,0 "; TestCycleRead(inputData, CycleType.MeasuredSpeed, crossWindRequired: true); // vair required, but not there: error - inputData = @"<t>,<v>,<grad>,<Padd> + inputData = @"<t>,<v>,<grad>,<Padd> 0 ,0 ,0 ,3.2018"; AssertHelper.Exception<VectoException>( () => TestCycleRead(inputData, CycleType.MeasuredSpeed, crossWindRequired: true), "ERROR while reading DrivingCycle Stream: Column vair_res was not found in DataRow."); // no aux, no vair - inputData = @"<t>,<v>,<grad>,<Padd> + inputData = @"<t>,<v>,<grad>,<Padd> 0 ,0 ,0 ,3.2018"; TestCycleRead(inputData, CycleType.MeasuredSpeed); // aux only - inputData = @"<t>,<v>,<grad>,<Padd>,<Aux_Alt> + inputData = @"<t>,<v>,<grad>,<Padd>,<Aux_Alt> 0 ,0 ,0 ,3.2018,0.504"; TestCycleRead(inputData, CycleType.MeasuredSpeed); // missing columns - inputData = @"<t>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_Alt> + inputData = @"<t>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_Alt> 0 ,0 ,3.2018,0 ,0 ,0.504"; AssertHelper.Exception<VectoException>(() => TestCycleRead(inputData, CycleType.MeasuredSpeed, autoCycle: false), "ERROR while reading DrivingCycle Stream: Column(s) required: v"); // not allowed columns - inputData = @"<t>,<v>,<wrong>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_Alt> + inputData = @"<t>,<v>,<wrong>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_Alt> 0 ,0 ,0 ,3.2018,0 ,0 ,0.504,0"; AssertHelper.Exception<VectoException>(() => TestCycleRead(inputData, CycleType.MeasuredSpeed, autoCycle: false), "ERROR while reading DrivingCycle Stream: Column(s) not allowed: wrong"); @@ -170,7 +170,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation "CycleFile format is unknown."); // wrong data - inputData = @"<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_Alt> + inputData = @"<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_Alt> 0 ,0"; AssertHelper.Exception<VectoException>(() => TestCycleRead(inputData, CycleType.MeasuredSpeed), "Line 1: The number of values is not correct. Expected 7 Columns, Got 2 Columns"); @@ -195,14 +195,14 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// Tests if the powertrain can be created in MeasuredSpeed mode. /// </summary> /// <remarks>VECTO-181</remarks> - [TestMethod] + [TestCase] public void MeasuredSpeed_CreatePowertrain_Gear() { // prepare input data - var inputData = @"<t>,<v> ,<grad> ,<Padd> ,<n> ,<gear> - 1 ,0 ,0 ,3.201815003,595.75 ,0 - 2 ,0.3112 ,0 ,4.532197507,983.75 ,1 - 3 ,5.2782 ,-0.041207832,2.453370264,723.75 ,1 + var inputData = @"<t>,<v> ,<grad> ,<Padd> ,<n> ,<gear> + 1 ,0 ,0 ,3.201815003,595.75 ,0 + 2 ,0.3112 ,0 ,4.532197507,983.75 ,1 + 3 ,5.2782 ,-0.041207832,2.453370264,723.75 ,1 4 ,10.5768,-0.049730127,3.520827362,1223.25,1"; var drivingCycle = DrivingCycleDataReader.ReadFromStream(inputData.ToStream(), CycleType.MeasuredSpeedGear, "", @@ -263,14 +263,14 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// Tests if the powertrain can be created in MeasuredSpeed mode. /// </summary> /// <remarks>VECTO-181</remarks> - [TestMethod] + [TestCase] public void MeasuredSpeed_CreatePowertrain() { // prepare input data - var inputData = @"<t>,<v> ,<grad> ,<Padd> - 1 ,0 ,0 ,3.201815003 - 2 ,0.3112 ,0 ,4.532197507 - 3 ,5.2782 ,-0.041207832,2.453370264 + var inputData = @"<t>,<v> ,<grad> ,<Padd> + 1 ,0 ,0 ,3.201815003 + 2 ,0.3112 ,0 ,4.532197507 + 3 ,5.2782 ,-0.041207832,2.453370264 4 ,10.5768,-0.049730127,3.520827362"; var drivingCycle = DrivingCycleDataReader.ReadFromStream(inputData.ToStream(), CycleType.MeasuredSpeed, "", false); @@ -355,7 +355,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation ResultFileHelper.TestSumFile(expectedSumFile, actualSumFile); } - [TestMethod] + [TestCase] public void MeasuredSpeed_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeed.vecto", @@ -364,7 +364,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\Results\MeasuredSpeed.vsum", @"TestData\MeasuredSpeed\MeasuredSpeed.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeedAux_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedAux.vecto", @@ -373,7 +373,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\Results\MeasuredSpeedAux.vsum", @"TestData\MeasuredSpeed\MeasuredSpeedAux.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeedVair_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedVair.vecto", @@ -382,7 +382,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\Results\MeasuredSpeedVair.vsum", @"TestData\MeasuredSpeed\MeasuredSpeedVair.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeedVair_WindFromFront_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedVairFront.vecto", @@ -391,7 +391,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\Results\MeasuredSpeedVairFront.vsum", @"TestData\MeasuredSpeed\MeasuredSpeedVairFront.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeedVair_WindFromBack_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedVairBack.vecto", @@ -400,7 +400,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\Results\MeasuredSpeedVairBack.vsum", @"TestData\MeasuredSpeed\MeasuredSpeedVairBack.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeedVair_NoWind_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedVairNoWind.vecto", @@ -410,7 +410,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\MeasuredSpeedVairNoWind.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeedVairAux_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedVairAux.vecto", @@ -419,7 +419,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\Results\MeasuredSpeedVairAux.vsum", @"TestData\MeasuredSpeed\MeasuredSpeedVairAux.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeed_Gear_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedGear.vecto", @@ -428,7 +428,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\Results\MeasuredSpeedGear.vsum", @"TestData\MeasuredSpeed\MeasuredSpeedGear.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeed_Gear_TractionInterruption_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedGear_TractionInterruption.vecto", @@ -438,7 +438,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\MeasuredSpeedGear_TractionInterruption.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeed_Gear_Aux_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedGearAux.vecto", @@ -447,7 +447,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\Results\MeasuredSpeedGearAux.vsum", @"TestData\MeasuredSpeed\MeasuredSpeedGearAux.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeed_Gear_Vair_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedGearVair.vecto", @@ -456,7 +456,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\Results\MeasuredSpeedGearVair.vsum", @"TestData\MeasuredSpeed\MeasuredSpeedGearVair.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeed_Gear_VairAux_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedGearVairAux.vecto", @@ -466,7 +466,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\MeasuredSpeedGearVairAux.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeed_Gear_AT_PS_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedGearAT-PS.vecto", @@ -476,7 +476,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\MeasuredSpeedGearAT-PS.vsum"); } - [TestMethod] + [TestCase] public void MeasuredSpeed_Gear_AT_Ser_Run() { RunJob(@"TestData\MeasuredSpeed\MeasuredSpeedGearAT-Ser.vecto", @@ -486,7 +486,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation @"TestData\MeasuredSpeed\MeasuredSpeedGearAT-Ser.vsum"); } - [TestMethod] + [TestCase] public void VcdbTest() { var tbl = VectoCSVFile.Read(@"TestData/MeasuredSpeed/VairBetaFull.vcdb"); diff --git a/VectoCore/VectoCoreTest/Models/Simulation/PwheelModeTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/PwheelModeTests.cs index b2d433c1ccd20dc90c3892fda5ff95220b93c23e..d76d7f19f46020b0427d27c5ad3ef5e6ef3be240 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/PwheelModeTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/PwheelModeTests.cs @@ -40,7 +40,6 @@ using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.InputData.FileIO.JSON; using TUGraz.VectoCore.Models.Simulation.Impl; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Simulation.Data; @@ -48,17 +47,18 @@ using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; using TUGraz.VectoCore.Models.SimulationComponent.Impl; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.Models.Simulation { - [TestClass] + [TestFixture] public class PwheelModeTests { /// <summary> /// Test if the cycle file can be read. /// </summary> /// <remarks>VECTO-177</remarks> - [TestMethod] + [TestCase] public void Pwheel_ReadCycle_Test() { var container = new VehicleContainer(ExecutionMode.Engineering); @@ -101,7 +101,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// Tests if the powertrain can be created in P_wheel_in mode. /// </summary> /// <remarks>VECTO-177</remarks> - [TestMethod] + [TestCase] public void Pwheel_CreatePowertrain_Test() { // prepare input data @@ -150,7 +150,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// Tests if the simulation works and the modfile and sumfile are correct in P_wheel_in mode. /// </summary> /// <remarks>VECTO-177</remarks> - [TestMethod] + [TestCase] public void Pwheel_Run_Test() { var jobFile = @"TestData\Pwheel\Pwheel.vecto"; @@ -178,7 +178,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation /// Tests if the simulation works and the modfile and sumfile are correct in P_wheel_in mode. /// </summary> /// <remarks>VECTO-177</remarks> - [TestMethod] + [TestCase] public void Pwheel_ultimate_Run_Test() { var jobFile = @"TestData\Pwheel\Pwheel_ultimate.vecto"; diff --git a/VectoCore/VectoCoreTest/Models/Simulation/SimulationTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/SimulationTests.cs index 04d9856d6d7751b2e5e320aa3c7ed7f6b791548b..196fdd87338c1e209576bc6d1e5406ef9bf6dddd 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/SimulationTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/SimulationTests.cs @@ -30,7 +30,6 @@ */ using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.FileIO.JSON; @@ -39,15 +38,16 @@ using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.Tests.Utils; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.Models.Simulation { - [TestClass] + [TestFixture] public class SimulationTests { private const string EngineOnlyJob = @"TestData\Jobs\EngineOnlyJob.vecto"; - [TestMethod] + [TestCase] public void TestSimulationEngineOnly() { var resultFileName = "TestEngineOnly-result.vmod"; @@ -58,7 +58,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation Assert.AreEqual(560.RPMtoRad(), container.EngineSpeed); } - [TestMethod] + [TestCase] public void TestEngineOnly_JobRun() { var actual = @"TestData\Jobs\EngineOnlyJob_Coach Engine Only short.vmod"; @@ -72,7 +72,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation ResultFileHelper.TestModFile(expected, actual); } - [TestMethod] + [TestCase] public void TestEngineOnly_SimulatorRun() { var actual = @"TestData\Jobs\EngineOnlyJob_Coach Engine Only short.vmod"; @@ -105,7 +105,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation return factory.SimulationRuns().First(); } - [TestMethod] + [TestCase] public void Test_VectoJob() { var jobFile = @"TestData\Jobs\24t Coach EngineOnly.vecto"; diff --git a/VectoCore/VectoCoreTest/Models/Simulation/VechicleContainerTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/VechicleContainerTests.cs index 8773ffb680e5b05f6544482a6293b6f369f4639d..fba3e8a773abd65fe19ff11a7cd2faa12bfc814a 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/VechicleContainerTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/VechicleContainerTests.cs @@ -29,27 +29,27 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCore.Models.Simulation.Impl; -using TUGraz.VectoCore.Models.SimulationComponent.Impl; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.Tests.Models.Simulation -{ - [TestClass] - public class VechicleContainerTests - { - private const string EngineFile = @"TestData\Components\24t Coach.veng"; - - [TestMethod] - public void VechicleContainerHasEngine() - { - var vehicle = new VehicleContainer(ExecutionMode.Engineering); - var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile, 0); - var engine = new CombustionEngine(vehicle, engineData); - - Assert.IsNotNull(vehicle.EngineSpeed); - } - } +using NUnit.Framework; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.Tests.Models.Simulation +{ + [TestFixture] + public class VechicleContainerTests + { + private const string EngineFile = @"TestData\Components\24t Coach.veng"; + + [TestCase] + public void VechicleContainerHasEngine() + { + var vehicle = new VehicleContainer(ExecutionMode.Engineering); + var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile, 0); + var engine = new CombustionEngine(vehicle, engineData); + + Assert.IsNotNull(vehicle.EngineSpeed); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/DistanceBasedDrivingCycleTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/DistanceBasedDrivingCycleTest.cs index 13b6120e445d441141237530baff6eb69544b180..4da358922f1913f5210f2b1b2cf5a4eca6e60ff6 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/DistanceBasedDrivingCycleTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/DistanceBasedDrivingCycleTest.cs @@ -29,7 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; @@ -44,7 +44,7 @@ using TUGraz.VectoCore.Tests.Utils; namespace TUGraz.VectoCore.Tests.Models.SimulationComponent { - [TestClass] + [TestFixture] public class DistanceBasedDrivingCycleTest { public const string ShortCycle = @"TestData\Cycles\Coach_24t_xshort.vdri"; @@ -52,7 +52,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent public const double Tolerance = 0.0001; - [TestMethod] + [TestCase] public void TestLimitRequst() { var data = new string[] { @@ -83,28 +83,28 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent // a request up to 10m succeeds, no speed change for the next 10m var response = cycle.OutPort().Request(absTime, 0.3.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); response = cycle.OutPort().Request(absTime, 1.3.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); response = cycle.OutPort().Request(absTime, 2.7.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); response = cycle.OutPort().Request(absTime, 3.5.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); // a request with 12m exceeds the speed change at 10m -> maxDistance == 10m response = cycle.OutPort().Request(absTime, 12.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseDrivingCycleDistanceExceeded)); + Assert.IsInstanceOf<ResponseDrivingCycleDistanceExceeded>(response); Assert.AreEqual(10, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance.Value()); response = cycle.OutPort().Request(absTime, 10.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); // drive 10m container.CommitSimulationStep(absTime, response.SimulationInterval); @@ -114,7 +114,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent // request with 8m succeeds response = cycle.OutPort().Request(absTime, 8.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); container.CommitSimulationStep(absTime, response.SimulationInterval); absTime += response.SimulationInterval; @@ -123,27 +123,27 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent // request with 3m more -> distance exceeded. maxDistance == 2m (approach next speed change, we are within 5m radius) response = cycle.OutPort().Request(absTime, 3.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseDrivingCycleDistanceExceeded)); + Assert.IsInstanceOf<ResponseDrivingCycleDistanceExceeded>(response); Assert.AreEqual(2, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance.Value()); // - - - - - - - - // request with 1m (18 -> 19m) => response exceeded, drive up to next sample point (at least 5m) response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseDrivingCycleDistanceExceeded)); + Assert.IsInstanceOf<ResponseDrivingCycleDistanceExceeded>(response); Assert.AreEqual(Constants.SimulationSettings.BrakeNextTargetDistance.Value(), ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance.Value(), 1e-6); // next request with 5m, as suggested => distance exceeded. maxDistance == 2m (next speed change).... response = cycle.OutPort().Request(absTime, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance); - Assert.IsInstanceOfType(response, typeof(ResponseDrivingCycleDistanceExceeded)); + Assert.IsInstanceOf<ResponseDrivingCycleDistanceExceeded>(response); Assert.AreEqual(2, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance.Value()); // ok response = cycle.OutPort().Request(absTime, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); } - [TestMethod] + [TestCase] public void TestDistanceRequest() { var cycleData = DrivingCycleDataReader.ReadFromFile(ShortCycle, CycleType.DistanceBased, false); @@ -170,7 +170,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent // waiting 40s in 1s steps for (var i = 0; i < 40; i++) { response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); Assert.AreEqual(0, driver.LastRequest.TargetVelocity.Value(), Tolerance); Assert.AreEqual(0.028416069495827, driver.LastRequest.Gradient.Value(), 1E-12); Assert.AreEqual(1, driver.LastRequest.dt.Value(), Tolerance); @@ -180,7 +180,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); Assert.AreEqual(5.SI<MeterPerSecond>().Value(), driver.LastRequest.TargetVelocity.Value(), Tolerance); Assert.AreEqual(0.0284160694958265, driver.LastRequest.Gradient.Value(), 1E-12); @@ -191,7 +191,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); Assert.AreEqual(5.SI<MeterPerSecond>().Value(), driver.LastRequest.TargetVelocity.Value(), Tolerance); Assert.AreEqual(0.0284160694958265, driver.LastRequest.Gradient.Value(), 1E-12); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs index b2d47b097db56f02d9b3fdfbf3f2346612d370c4..4552c62b98c695904fafe70b0225e7c86f405ed6 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs @@ -31,7 +31,6 @@ using System.Collections.Generic; using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; @@ -49,10 +48,11 @@ using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.Tests.Utils; using TUGraz.VectoCore.Utils; using Wheels = TUGraz.VectoCore.Models.SimulationComponent.Impl.Wheels; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.Models.SimulationComponent { - [TestClass] + [TestFixture] public class DriverTest { public const string JobFile = @"TestData\Jobs\24t Coach EngineOnly.vecto"; @@ -61,7 +61,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent public const string AccelerationFile = @"TestData\Components\Coach.vacc"; public const double Tolerance = 0.001; - [TestMethod] + [TestCase] public void DriverCoastingTest() { var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile, 1); @@ -97,7 +97,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var response = driver.DrivingActionCoast(absTime, 1.SI<Meter>(), velocity, 0.SI<Radian>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); vehicleContainer.CommitSimulationStep(absTime, response.SimulationInterval); absTime += response.SimulationInterval; @@ -110,7 +110,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent while (vehicleContainer.VehicleSpeed > 1.7) { response = driver.DrivingActionCoast(absTime, 1.SI<Meter>(), velocity, 0.SI<Radian>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); vehicleContainer.CommitSimulationStep(absTime, response.SimulationInterval); absTime += response.SimulationInterval; @@ -119,7 +119,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent modData.Finish(VectoRun.Status.Success); } - [TestMethod] + [TestCase] public void DriverCoastingTest2() { var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile, 1); @@ -157,7 +157,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var response = driver.DrivingActionCoast(absTime, 1.SI<Meter>(), velocity, gradient); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); vehicleContainer.CommitSimulationStep(absTime, response.SimulationInterval); absTime += response.SimulationInterval; @@ -170,7 +170,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent while (vehicleContainer.VehicleSpeed > 1.7) { response = driver.DrivingActionCoast(absTime, 1.SI<Meter>(), velocity, gradient); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); vehicleContainer.CommitSimulationStep(absTime, response.SimulationInterval); absTime += response.SimulationInterval; @@ -179,7 +179,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent modData.Finish(VectoRun.Status.Success); } - [TestMethod] + [TestCase] public void DriverOverloadTest() { var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFileHigh, 1); @@ -219,7 +219,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var response = driverPort.Request(absTime, 1.SI<Meter>(), 20.SI<MeterPerSecond>(), 0.SI<Radian>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); vehicleContainer.CommitSimulationStep(absTime, response.SimulationInterval); absTime += response.SimulationInterval; @@ -228,7 +228,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent response = driverPort.Request(absTime, 1.SI<Meter>(), 20.SI<MeterPerSecond>(), 0.SI<Radian>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); vehicleContainer.CommitSimulationStep(absTime, response.SimulationInterval); absTime += response.SimulationInterval; @@ -236,7 +236,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent Assert.AreEqual(0.2900, modData.GetValues<SI>(ModalResultField.acc).Last().Value(), Tolerance); } - [TestMethod] + [TestCase] public void DriverAccelerationTest() { var vehicleContainer = new VehicleContainer(ExecutionMode.Engineering); @@ -271,7 +271,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent for (var i = 0; i < accelerations.Length; i++) { var tmpResponse = driver.OutPort().Request(absTime, ds, targetVelocity, gradient); - Assert.IsInstanceOfType(tmpResponse, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(tmpResponse); Assert.AreEqual(accelerations[i], vehicle.LastRequest.acceleration.Value(), Tolerance); Assert.AreEqual(simulationIntervals[i], tmpResponse.SimulationInterval.Value(), Tolerance); @@ -284,7 +284,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent // full acceleration would exceed target velocity, driver should limit acceleration such that target velocity is reached... var response = driver.OutPort().Request(absTime, ds, targetVelocity, gradient); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); Assert.AreEqual(0.899715479, vehicle.LastRequest.acceleration.Value(), Tolerance); Assert.AreEqual(0.203734517, response.SimulationInterval.Value(), Tolerance); @@ -299,12 +299,12 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent response = driver.OutPort().Request(absTime, ds, targetVelocity, gradient); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); Assert.AreEqual(0, vehicle.LastRequest.acceleration.Value(), Tolerance); Assert.AreEqual(0.2, response.SimulationInterval.Value(), Tolerance); } - [TestMethod] + [TestCase] public void DriverDecelerationTest() { var vehicleContainer = new VehicleContainer(ExecutionMode.Engineering); @@ -345,7 +345,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent for (var i = 0; i < accelerations.Length; i++) { var tmpResponse = driver.OutPort().Request(absTime, ds, targetVelocity, gradient); - Assert.IsInstanceOfType(tmpResponse, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(tmpResponse); Assert.AreEqual(accelerations[i], vehicle.LastRequest.acceleration.Value(), Tolerance); Assert.AreEqual(simulationIntervals[i], tmpResponse.SimulationInterval.Value(), Tolerance); @@ -357,7 +357,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var response = driver.OutPort().Request(absTime, ds, targetVelocity, gradient); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(response); Assert.AreEqual(-0.308576594, vehicle.LastRequest.acceleration.Value(), Tolerance); Assert.AreEqual(2.545854078, response.SimulationInterval.Value(), Tolerance); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxPowertrainTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxPowertrainTest.cs index 543f36218a2ffb9b5c934d08e83f3c58a5971532..eac6e6d63ed3a70c2d4401e805ad4b6d843116d8 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxPowertrainTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxPowertrainTest.cs @@ -29,7 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Tests.Integration; @@ -37,10 +37,10 @@ using TUGraz.VectoCore.Tests.Utils; namespace TUGraz.VectoCore.Tests.Models.SimulationComponent { - [TestClass] + [TestFixture] public class GearboxPowertrainTest { - [TestMethod] + [TestCase] public void Gearbox_Initialize_Empty() { var cycle = SimpleDrivingCycles.CreateCycleData(new[] { @@ -52,7 +52,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent 0.SI<Kilogram>()); var retVal = container.Cycle.Initialize(); Assert.AreEqual(4u, container.Gear); - Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(retVal); AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed); @@ -71,7 +71,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent AssertHelper.AreRelativeEqual(65.6890, container.EngineSpeed); } - [TestMethod] + [TestCase] public void Gearbox_Initialize_RefLoad() { var cycle = SimpleDrivingCycles.CreateCycleData(new[] { @@ -83,7 +83,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent 19300.SI<Kilogram>()); var retVal = container.Cycle.Initialize(); Assert.AreEqual(4u, container.Gear); - Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(retVal); AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed); @@ -102,7 +102,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent AssertHelper.AreRelativeEqual(87.3192, container.EngineSpeed); } - [TestMethod] + [TestCase] public void Gearbox_Initialize_85_RefLoad() { var cycle = SimpleDrivingCycles.CreateCycleData(new[] { @@ -114,7 +114,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent 19300.SI<Kilogram>()); var retVal = container.Cycle.Initialize(); Assert.AreEqual(12u, container.Gear); - Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess)); + Assert.IsInstanceOf<ResponseSuccess>(retVal); AssertHelper.AreRelativeEqual(1195.996.RPMtoRad(), container.EngineSpeed, toleranceFactor: 1e-3); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/RetarderTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/RetarderTest.cs index 09ebd216387078b6090e5734e5cfe4eb66c97945..17da8c5f8f268e9f47fbe967e4092ff65591e311 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/RetarderTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/RetarderTest.cs @@ -29,7 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; @@ -41,13 +41,13 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Tests.Models.SimulationComponent { - [TestClass] + [TestFixture] public class RetarderTest { private const string RetarderLossMapFile = @"TestData\Components\Retarder.vrlm"; private const double Delta = 0.0001; - [TestMethod] + [TestCase] public void RetarderBasicTest() { var vehicle = new VehicleContainer(ExecutionMode.Declaration); @@ -92,7 +92,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent Assert.AreEqual(50 + 12, nextRequest.Torque.Value(), Delta); } - [TestMethod] + [TestCase] public void RetarderRatioTest() { var vehicle = new VehicleContainer(ExecutionMode.Engineering); @@ -129,7 +129,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent Assert.AreEqual(50 + 13.89, nextRequest.Torque.Value(), Delta); // extrapolated } - [TestMethod] + [TestCase] public void RetarderDeclarationTest() { var retarderData = RetarderLossMapReader.ReadFromFile(RetarderLossMapFile); @@ -146,7 +146,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent "Retarder LossMap data was extrapolated in Declaration mode: range for loss map is not sufficient: n:2550 (min:0, max:2300), ratio:2"); } - [TestMethod] + [TestCase] public void RetarderDataSorting() { var retarderEntries = new[] { diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/WheelsTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/WheelsTest.cs index e4340dac4d236b7bee94adb2281fa22d10729243..ddc244f2b15862b9833310912836bb40b3f63512 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/WheelsTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/WheelsTest.cs @@ -29,7 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Simulation.Impl; @@ -39,12 +39,12 @@ using TUGraz.VectoCore.Tests.Utils; namespace TUGraz.VectoCore.Tests.Models.SimulationComponent { - [TestClass] + [TestFixture] public class WheelsTest { private const string VehicleDataFile = @"TestData\Components\24t Coach.vveh"; - [TestMethod] + [TestCase] public void WheelsRequestTest() { var container = new VehicleContainer(ExecutionMode.Engineering); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/AccelerationCurveTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/AccelerationCurveTest.cs index 24e952c97dbe42bda92ae443ab2fa33ddf1ad1e1..3ba552748815572ce243dbbe330a4dfb27221e1d 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/AccelerationCurveTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/AccelerationCurveTest.cs @@ -29,14 +29,14 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.Reader.ComponentData; using TUGraz.VectoCore.Models.SimulationComponent.Data; namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData { - [TestClass] + [TestFixture] public class AccelerationCurveTest { public const double Tolerance = 0.0001; @@ -49,7 +49,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.AreEqual(entry.Deceleration.Value(), deceleration, Tolerance); } - [TestMethod] + [TestCase] public void AccelerationTest() { Data = AccelerationCurveReader.ReadFromFile(@"TestData\Components\Coach.vacc"); @@ -112,7 +112,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData EqualAcceleration(130, 0.16, -0.103); } - [TestMethod] + [TestCase] public void ComputeAccelerationDistanceTest() { Data = AccelerationCurveReader.ReadFromFile(@"TestData\Components\Truck.vacc"); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/AuxiliaryTypeHelperTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/AuxiliaryTypeHelperTest.cs index b778a343a834bd9ad37fcf92dbb60a34563e2cc1..e6ae231bc2aabc5e65c3618ebb4a2db9ef0983fc 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/AuxiliaryTypeHelperTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/AuxiliaryTypeHelperTest.cs @@ -29,19 +29,17 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; +using NUnit.Framework; using TUGraz.VectoCommon.Models; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Models.Declaration; -using TUGraz.VectoCore.Tests.Utils; namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData { - [TestClass] + [TestFixture] public class AuxiliaryTypeHelperTest { - [TestMethod] + [TestCase] public void TestParseAuxiliaryType() { Assert.AreEqual(AuxiliaryType.Fan, AuxiliaryTypeHelper.Parse("Fan")); @@ -51,7 +49,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.AreEqual(AuxiliaryType.PneumaticSystem, AuxiliaryTypeHelper.Parse("Pneumatic System")); } - [TestMethod] + [TestCase] public void TestToString() { Assert.AreEqual(Constants.Auxiliaries.Names.Fan, AuxiliaryTypeHelper.ToString(AuxiliaryType.Fan)); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/DistanceCycleDataTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/DistanceCycleDataTest.cs index 56728eeb8cfc5036574f150197f2f8d86284dc82..585ae69e2f38c7b92f7215009843e424851c8c40 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/DistanceCycleDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/DistanceCycleDataTest.cs @@ -29,7 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.Reader; @@ -40,14 +40,14 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData { - [TestClass] + [TestFixture] public class DistanceCycleDataTest { // public readonly string CycleFile = @"TestData\Cycles\"; private const string ResourceNamespace = "TUGraz.VectoCore.Resources.Declaration."; - [TestMethod] + [TestCase] public void FilterRedundantEntries() { var data = new[] { @@ -71,7 +71,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.AreEqual(9, cycleData.Entries[2].Distance.Value()); } - [TestMethod] + [TestCase] public void HandleStopTimes() { var data = new[] { @@ -98,7 +98,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.AreEqual(5, cycleData.Entries[1].StoppingTime.Value()); } - [TestMethod] + [TestCase] public void StopTimeWhenVehicleSpeedIsNotZero() { var data = new[] { @@ -110,7 +110,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData AssertHelper.Exception<VectoException>(() => SimpleDrivingCycles.CreateCycleData(data)); } - [TestMethod] + [TestCase] public void DistanceNotStrictlyIncreasing() { var data = new[] { @@ -122,7 +122,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData AssertHelper.Exception<VectoException>(() => SimpleDrivingCycles.CreateCycleData(data)); } - [TestMethod] + [TestCase] public void CycleAltitudeTest() { var missionType = "LongHaul"; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/FuelConsumptionMapTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/FuelConsumptionMapTest.cs index bc4b51c6a9b40d7c26decd6bb24e01b9c9fc82e8..2603aa7cad32b5a6154355883913c66ad1a5b103 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/FuelConsumptionMapTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/FuelConsumptionMapTest.cs @@ -33,18 +33,18 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData { - [TestClass] + [TestFixture] public class FuelConsumptionMapTest { private const double Tolerance = 0.0001; - [TestMethod] + [TestCase] public void TestFuelConsumption_FixedPoints() { var map = FuelConsumptionMapReader.ReadFromFile(@"TestData\Components\24t Coach.vmap"); @@ -52,7 +52,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData AssertMapValuesEqual(lines, map); } - [TestMethod] + [TestCase] public void TestFuelConsumption_InterpolatedPoints() { var map = FuelConsumptionMapReader.ReadFromFile(@"TestData\Components\24t Coach.vmap"); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/FullLoadCurveTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/FullLoadCurveTest.cs index 925f6301b079eb7fc36f739b974a04ec27af2fb6..93e8198f73abe07bafb007e55c78521be8d19cb4 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/FullLoadCurveTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/FullLoadCurveTest.cs @@ -30,7 +30,6 @@ */ using System.Collections.Generic; -using Microsoft.VisualStudio.TestTools.UnitTesting; using NLog; using NLog.Config; using NLog.Targets; @@ -44,10 +43,11 @@ using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; using TUGraz.VectoCore.Tests.Utils; using TUGraz.VectoCore.Utils; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData { - [TestClass] + [TestFixture] public class FullLoadCurveTest { private const string CoachEngineFLD = @"TestData\Components\24t Coach.vfld"; @@ -55,7 +55,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData public static List<string> LogList = new List<string>(); - [TestMethod] + [TestCase] public void TestFullLoadStaticTorque() { var fldCurve = FullLoadCurveReader.ReadFromFile(CoachEngineFLD); @@ -65,14 +65,14 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.AreEqual(1231, fldCurve.FullLoadStationaryTorque(580.RPMtoRad()).Value(), Tolerance); } - [TestMethod] + [TestCase] public void TestFullLoadEngineSpeedRated() { var fldCurve = FullLoadCurveReader.ReadFromFile(CoachEngineFLD); Assert.AreEqual(181.8444, fldCurve.RatedSpeed.Value(), Tolerance); } - [TestMethod] + [TestCase] public void TestFullLoadStaticPower() { var fldCurve = FullLoadCurveReader.ReadFromFile(CoachEngineFLD); @@ -82,7 +82,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.AreEqual(74767.810760, fldCurve.FullLoadStationaryPower(580.RPMtoRad()).Value(), Tolerance); } - [TestMethod] + [TestCase] public void TestDragLoadStaticTorque() { var fldCurve = FullLoadCurveReader.ReadFromFile(CoachEngineFLD); @@ -94,7 +94,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.AreEqual(-339, fldCurve.DragLoadStationaryTorque(2200.RPMtoRad()).Value(), Tolerance); } - [TestMethod] + [TestCase] public void TestDragLoadStaticPower() { var fldCurve = FullLoadCurveReader.ReadFromFile(CoachEngineFLD); @@ -104,7 +104,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.AreEqual(-9019.51251, fldCurve.DragLoadStationaryPower(580.RPMtoRad()).Value(), Tolerance); } - [TestMethod] + [TestCase] public void TestPT1() { var fldCurve = FullLoadCurveReader.ReadFromFile(CoachEngineFLD); @@ -114,7 +114,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.AreEqual(0.37, fldCurve.PT1(1700.RPMtoRad()).Value.Value(), Tolerance); } - [TestMethod] + [TestCase] public void TestPreferredSpeed() { var fldCurve = FullLoadCurveReader.ReadFromFile(CoachEngineFLD); @@ -130,7 +130,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData AssertHelper.AreRelativeEqual(-320.SI<NewtonMeter>(), fldCurve.MaxDragTorque); } - [TestMethod] + [TestCase] public void TestPreferredSpeed2() { var fldData = new[] { @@ -155,7 +155,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData //AssertHelper.AreRelativeEqual(130.691151551712.SI<PerSecond>(), fldCurve.PreferredSpeed); } - [TestMethod] + [TestCase] public void TestN95hSpeedInvalid() { var fldData = new[] { @@ -184,7 +184,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData /// <summary> /// [VECTO-78] /// </summary> - [TestMethod] + [TestCase] public void Test_FileRead_WrongFileFormat_InsufficientColumns() { AssertHelper.Exception<VectoException>( @@ -195,7 +195,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData /// <summary> /// [VECTO-78] /// </summary> - [TestMethod] + [TestCase] public void Test_FileRead_HeaderColumnsNotNamedCorrectly() { LogList.Clear(); @@ -222,7 +222,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData /// <summary> /// [VECTO-78] /// </summary> - [TestMethod] + [TestCase] public void Test_FileRead_NoHeader() { var curve = FullLoadCurveReader.ReadFromFile(@"TestData\Components\FullLoadCurve no header.vfld"); @@ -233,7 +233,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData /// <summary> /// [VECTO-78] /// </summary> - [TestMethod] + [TestCase] public void Test_FileRead_InsufficientEntries() { AssertHelper.Exception<VectoException>( @@ -241,7 +241,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData "ERROR while reading FullLoadCurve File: FullLoadCurve must consist of at least two lines with numeric values (below file header)"); } - [TestMethod] + [TestCase] public void FullLoad_LossMap_Test() { var engineData = new CombustionEngineData { @@ -273,7 +273,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData /// <summary> /// [VECTO-190] /// </summary> - [TestMethod] + [TestCase] public void TestSortingFullLoadEntries() { var fldEntries = new[] { diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs index 8c2da74da095f1c4078d901243c76649855a429e..ec5ac40ea6aa9e38e75ef00047ce8cc970be99db 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs @@ -29,7 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Data; @@ -54,7 +54,7 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData { - [TestClass] + [TestFixture] [SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "UnusedMember.Local")] public class ValidationTestClass @@ -62,7 +62,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData /// <summary> /// VECTO-107 Check valid range of input parameters /// </summary> - [TestMethod] + [TestCase] public void Validation_CombustionEngineData() { var fuelConsumption = new DataTable(); @@ -99,7 +99,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.IsTrue(data.IsValid()); } - [TestMethod] + [TestCase] public void Validation_CombustionEngineData_Engineering() { var fuelConsumption = new TableData(); @@ -134,7 +134,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.IsTrue(engineData.IsValid()); } - [TestMethod] + [TestCase] public void Validation_CombustionEngineData_Declaration() { var fuelConsumption = new TableData(); @@ -178,7 +178,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.IsTrue(engineData.IsValid()); } - [TestMethod] + [TestCase] public void ValidationModeVehicleDataTest() { var vehicleData = new VehicleData { @@ -217,7 +217,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData /// <summary> /// VECTO-107 Check valid range of input parameters /// </summary> - [TestMethod] + [TestCase] public void ValidationModeVectoRunDataTest() { var container = new VehicleContainer(ExecutionMode.Engineering); @@ -295,7 +295,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData /// <summary> /// VECTO-107 Check valid range of input parameters /// </summary> - [TestMethod] + [TestCase] public void Validation_VectoRun() { var container = new VehicleContainer(ExecutionMode.Engineering); @@ -336,7 +336,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData /// <summary> /// VECTO-107 Check valid range of input parameters /// </summary> - [TestMethod] + [TestCase] public void Validation_Test() { var results = new DataObject().Validate(ExecutionMode.Declaration, null, false); @@ -347,7 +347,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData "Validation Error: " + string.Join("\n_eng_avg", results.Select(r => r.ErrorMessage))); } - [TestMethod] + [TestCase] public void ValidateDictionaryTest() { var container = new ContainerObject() { @@ -364,7 +364,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData /// <summary> /// VECTO-249: check upshift is above downshift /// </summary> - [TestMethod] + [TestCase] public void ShiftPolygonValidationTest() { var vgbs = new[] { @@ -393,7 +393,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.IsTrue(results.Any()); } - [TestMethod] + [TestCase] public void ShiftPolygonValidationATTest() { var vgbs = new[] { @@ -429,12 +429,12 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData public class WrapperObject { - [Required, Range(0, 100)] public int Value = 0; + [Required, System.ComponentModel.DataAnnotations.Range(0, 100)] public int Value = 0; } public class DeepDataObject { - [Required, Range(41, 42)] protected int public_field = 5; + [Required, System.ComponentModel.DataAnnotations.Range(41, 42)] protected int public_field = 5; } public abstract class ParentDataObject @@ -442,43 +442,43 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData #region 4 parent instance fields // ReSharper disable once NotAccessedField.Local - [Required, Range(1, 2)] private int private_parent_field = 7; - [Required, Range(3, 4)] protected int protected_parent_field = 7; - [Required, Range(5, 6)] internal int internal_parent_field = 7; - [Required, Range(7, 8)] public int public_parent_field = 5; + [Required, System.ComponentModel.DataAnnotations.Range(1, 2)] private int private_parent_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(3, 4)] protected int protected_parent_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(5, 6)] internal int internal_parent_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(7, 8)] public int public_parent_field = 5; #endregion #region 4 parent static field - [Required, Range(43, 44)] private static int private_static_parent_field = 7; - [Required, Range(43, 44)] protected static int protected_static_parent_field = 7; - [Required, Range(50, 51)] internal static int internal_static_parent_field = 7; - [Required, Range(45, 46)] public static int public_static_parent_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(43, 44)] private static int private_static_parent_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(43, 44)] protected static int protected_static_parent_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(50, 51)] internal static int internal_static_parent_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(45, 46)] public static int public_static_parent_field = 7; #endregion #region 4 parent instance properties - [Required, Range(11, 12)] + [Required, System.ComponentModel.DataAnnotations.Range(11, 12)] private int private_parent_property { get { return 7; } } - [Required, Range(13, 14)] + [Required, System.ComponentModel.DataAnnotations.Range(13, 14)] protected int protected_parent_property { get { return 7; } } - [Required, Range(15, 16)] + [Required, System.ComponentModel.DataAnnotations.Range(15, 16)] internal int internal_parent_property { get { return 7; } } - [Required, Range(17, 18)] + [Required, System.ComponentModel.DataAnnotations.Range(17, 18)] public int public_parent_property { get { return 7; } @@ -488,25 +488,25 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData #region 4 parent static properties - [Required, Range(19, 20)] + [Required, System.ComponentModel.DataAnnotations.Range(19, 20)] private static int private_static_parent_property { get { return 7; } } - [Required, Range(19, 20)] + [Required, System.ComponentModel.DataAnnotations.Range(19, 20)] protected static int protected_static_parent_property { get { return 7; } } - [Required, Range(19, 20)] + [Required, System.ComponentModel.DataAnnotations.Range(19, 20)] internal static int internal_static_parent_property { get { return 7; } } - [Required, Range(19, 20)] + [Required, System.ComponentModel.DataAnnotations.Range(19, 20)] public static int public_static_parent_property { get { return 7; } @@ -531,43 +531,43 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData #region 4 instance fields // ReSharper disable once NotAccessedField.Local - [Required, Range(1, 2)] private int private_field = 7; - [Required, Range(3, 4)] protected int protected_field = 7; - [Required, Range(5, 6)] internal int internal_field = 7; - [Required, Range(7, 8)] public int public_field = 5; + [Required, System.ComponentModel.DataAnnotations.Range(1, 2)] private int private_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(3, 4)] protected int protected_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(5, 6)] internal int internal_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(7, 8)] public int public_field = 5; #endregion #region 4 static field - [Required, Range(43, 44)] private static int private_static_field = 7; - [Required, Range(43, 44)] protected static int protected_static_field = 7; - [Required, Range(50, 51)] internal static int internal_static_field = 7; - [Required, Range(45, 46)] public static int public_static_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(43, 44)] private static int private_static_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(43, 44)] protected static int protected_static_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(50, 51)] internal static int internal_static_field = 7; + [Required, System.ComponentModel.DataAnnotations.Range(45, 46)] public static int public_static_field = 7; #endregion #region 4 instance properties - [Required, Range(11, 12)] + [Required, System.ComponentModel.DataAnnotations.Range(11, 12)] private int private_property { get { return 7; } } - [Required, Range(13, 14)] + [Required, System.ComponentModel.DataAnnotations.Range(13, 14)] protected int protected_property { get { return 7; } } - [Required, Range(15, 16)] + [Required, System.ComponentModel.DataAnnotations.Range(15, 16)] internal int internal_property { get { return 7; } } - [Required, Range(17, 18)] + [Required, System.ComponentModel.DataAnnotations.Range(17, 18)] public int public_property { get { return 7; } @@ -577,25 +577,25 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData #region 4 static properties - [Required, Range(19, 20)] + [Required, System.ComponentModel.DataAnnotations.Range(19, 20)] private static int private_static_property { get { return 7; } } - [Required, Range(19, 20)] + [Required, System.ComponentModel.DataAnnotations.Range(19, 20)] protected static int protected_static_property { get { return 7; } } - [Required, Range(19, 20)] + [Required, System.ComponentModel.DataAnnotations.Range(19, 20)] internal static int internal_static_property { get { return 7; } } - [Required, Range(19, 20)] + [Required, System.ComponentModel.DataAnnotations.Range(19, 20)] public static int public_static_property { get { return 7; } diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/VehicleDataTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/VehicleDataTest.cs index ceefbe92f2b0103450fec6a81f0737575482d001..9377175da5df3a108029228790a555e3c0de96d8 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/VehicleDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/VehicleDataTest.cs @@ -29,16 +29,16 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData { - [TestClass] + [TestFixture] public class VehicleDataTest { private const string VehicleDataFile = @"TestData\Components\24t Coach.vveh"; - [TestMethod] + [TestCase] public void ReadVehicleFileTest() { //IDataFileReader reader = new EngineeringModeSimulationDataReader(); diff --git a/VectoCore/VectoCoreTest/Reports/SumWriterTest.cs b/VectoCore/VectoCoreTest/Reports/SumWriterTest.cs index 7dfe30ef6f3456073a3a8381f7a6e69750f03090..e9fece1934fa6467437e42f614403aa5a33ccb32 100644 --- a/VectoCore/VectoCoreTest/Reports/SumWriterTest.cs +++ b/VectoCore/VectoCoreTest/Reports/SumWriterTest.cs @@ -31,27 +31,25 @@ using System.IO; using System.Xml; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.FileIO.XML.Declaration; -using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.OutputData.XML; -using TUGraz.VectoCore.Tests.Models.SimulationComponent; using TUGraz.VectoCore.Tests.Utils; using TUGraz.VectoCore.Utils; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.Reports { - [TestClass] + [TestFixture] public class SumWriterTest { - [TestMethod] + [TestCase] public void TestSumCalcFixedTime() { var writer = new FileOutputWriter("testsumcalc_fixed"); @@ -107,7 +105,7 @@ namespace TUGraz.VectoCore.Tests.Reports Assert.AreEqual((500.0 * 1e-4) * 1000 * 1000 / 499.0, sumData.Rows[0].ParseDouble("FC-Map [g/km]"), 1e-3); } - [TestMethod] + [TestCase] public void TestSumCalcVariableTime() { var writer = new FileOutputWriter("testsumcalc_var"); @@ -160,7 +158,7 @@ namespace TUGraz.VectoCore.Tests.Reports Assert.AreEqual(0.934722222, sumData.Rows[0].ParseDouble("E_brake [kWh]"), 1e-3); } - [TestMethod] + [TestCase] public void TestSumDataMetaInformation() { var jobfile = @"Testdata\XML\XMLReaderDeclaration\vecto_vehicle-sample.xml"; diff --git a/VectoCore/VectoCoreTest/Utils/DelauneyMapTest.cs b/VectoCore/VectoCoreTest/Utils/DelauneyMapTest.cs index cb8199647242d0527f23598a7b6843903cae97c4..690297e5c6be0862a0229b0c66a4dcbb25fce08d 100644 --- a/VectoCore/VectoCoreTest/Utils/DelauneyMapTest.cs +++ b/VectoCore/VectoCoreTest/Utils/DelauneyMapTest.cs @@ -29,7 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; using System; using System.IO; using System.Linq; @@ -39,10 +39,10 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Tests.Utils { - [TestClass] + [TestFixture] public class DelaunayMapTest { - [TestMethod] + [TestCase] public void Test_Simple_DelaunayMap() { var map = new DelaunayMap("TEST"); @@ -57,7 +57,7 @@ namespace TUGraz.VectoCore.Tests.Utils AssertHelper.AreRelativeEqual(0, result); } - [TestMethod] + [TestCase] public void Test_DelaunayMapTriangle() { var map = new DelaunayMap("TEST"); @@ -132,7 +132,7 @@ namespace TUGraz.VectoCore.Tests.Utils AssertHelper.Exception<VectoException>(() => map.Interpolate(-1.5, -0.5), "Interpolation failed."); } - [TestMethod] + [TestCase] public void Test_Delaunay_LessThan3Points() { AssertHelper.Exception<ArgumentException>(() => new DelaunayMap("TEST").Triangulate(), @@ -158,7 +158,7 @@ namespace TUGraz.VectoCore.Tests.Utils map.Triangulate(); } - [TestMethod] + [TestCase] public void Test_Delaunay_DuplicatePoints() { var map = new DelaunayMap("TEST"); @@ -172,7 +172,7 @@ namespace TUGraz.VectoCore.Tests.Utils "TEST: Input Data for Delaunay map contains duplicates! \n1 / 1"); } - [TestMethod] + [TestCase] public void Test_Delaunay_NormalOperation() { foreach (var factors in new[] { diff --git a/VectoCore/VectoCoreTest/Utils/DoubleExtensionMethodTest.cs b/VectoCore/VectoCoreTest/Utils/DoubleExtensionMethodTest.cs index fec0d4c63319ce7f1c06438b0a02dd93a1721aaa..d69d3858e7791de8a85827e6398a8ac183361ff7 100644 --- a/VectoCore/VectoCoreTest/Utils/DoubleExtensionMethodTest.cs +++ b/VectoCore/VectoCoreTest/Utils/DoubleExtensionMethodTest.cs @@ -1,44 +1,44 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2017 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Utils; - +using NUnit.Framework; + namespace TUGraz.VectoCore.Tests.Utils { - [TestClass] + [TestFixture] public class DoubleExtensionMethodTest { - [TestMethod] + [TestCase] public void DoubleExtensions_SI() { var val = 600.RPMtoRad(); @@ -57,7 +57,7 @@ namespace TUGraz.VectoCore.Tests.Utils Assert.AreEqual(600.SI().Rounds.Per.Minute.Cast<PerSecond>().Value(), val2.Value()); } - [TestMethod] + [TestCase] public void DoubleExtension_ComparisonOperators() { Assert.IsTrue(0.0.IsEqual(0.0)); @@ -104,7 +104,7 @@ namespace TUGraz.VectoCore.Tests.Utils Assert.IsTrue(0.998.IsSmallerOrEqual(1.0)); } - [TestMethod] + [TestCase] public void TestStringFormatting() { Assert.AreEqual("0.452", 0.452345.ToMinSignificantDigits(3, 1)); diff --git a/VectoCore/VectoCoreTest/Utils/SITest.cs b/VectoCore/VectoCoreTest/Utils/SITest.cs index e68b08af69d167cc4a92f4720ba12ea7c56419a2..1a247a06811a3388d0116857507f7e966cf0b405 100644 --- a/VectoCore/VectoCoreTest/Utils/SITest.cs +++ b/VectoCore/VectoCoreTest/Utils/SITest.cs @@ -31,17 +31,17 @@ using System; using System.Diagnostics.CodeAnalysis; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Utils; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.Utils { - [TestClass] + [TestFixture] public class SITest { - [TestMethod] + [TestCase] [SuppressMessage("ReSharper", "UnusedVariable")] public void SI_TypicalUsageTest() { @@ -49,26 +49,26 @@ namespace TUGraz.VectoCore.Tests.Utils var angularVelocity = 600.RPMtoRad(); var torque = 1500.SI<NewtonMeter>(); var power = angularVelocity * torque; - Assert.IsInstanceOfType(power, typeof(Watt)); + Assert.IsInstanceOf<Watt>(power); Assert.AreEqual(600.0 / 60 * 2 * Math.PI * 1500, power.Value()); var siStandardMult = power * torque; - Assert.IsInstanceOfType(siStandardMult, typeof(SI)); + Assert.IsInstanceOf<SI>(siStandardMult); Assert.AreEqual(600.0 / 60 * 2 * Math.PI * 1500 * 1500, siStandardMult.Value()); Assert.IsTrue(siStandardMult.HasEqualUnit(new SI().Watt.Newton.Meter)); //div var torque2 = power / angularVelocity; - Assert.IsInstanceOfType(torque2, typeof(NewtonMeter)); + Assert.IsInstanceOf<NewtonMeter>(torque2); Assert.AreEqual(1500, torque2.Value()); var siStandardDiv = power / power; - Assert.IsInstanceOfType(siStandardMult, typeof(SI)); + Assert.IsInstanceOf<SI>(siStandardMult); Assert.IsTrue(siStandardDiv.HasEqualUnit(new SI())); Assert.AreEqual(600.0 / 60 * 2 * Math.PI * 1500 * 1500, siStandardMult.Value()); var force = torque / 100.SI<Meter>(); - Assert.IsInstanceOfType(force, typeof(Newton)); + Assert.IsInstanceOf<Newton>(force); Assert.AreEqual(15, force.Value()); var test = 2.0.SI<PerSecond>(); @@ -87,7 +87,7 @@ namespace TUGraz.VectoCore.Tests.Utils //general si unit var generalSIUnit = 3600000000.0.SI().Gramm.Per.Kilo.Watt.Hour.ConvertTo().Kilo.Gramm.Per.Watt.Second; - Assert.IsInstanceOfType(generalSIUnit, typeof(SI)); + Assert.IsInstanceOf<SI>(generalSIUnit); Assert.AreEqual(1, generalSIUnit.Value()); //type conversion @@ -96,7 +96,7 @@ namespace TUGraz.VectoCore.Tests.Utils // convert between units measures var angularVelocity4 = engineSpeed.SI().Rounds.Per.Minute.ConvertTo().Radian.Per.Second; - Assert.IsInstanceOfType(angularVelocity4, typeof(SI)); + Assert.IsInstanceOf<SI>(angularVelocity4); // cast SI to specialized unit classes. PerSecond angularVelocity5 = angularVelocity4.Cast<PerSecond>(); @@ -112,7 +112,7 @@ namespace TUGraz.VectoCore.Tests.Utils var res2 = 40.SI().Newton.Cast<Newton>(); } - [TestMethod] + [TestCase] public void SI_Test() { var si = new SI(); @@ -164,7 +164,7 @@ namespace TUGraz.VectoCore.Tests.Utils Assert.AreEqual(45.0 / 180.0 * Math.PI, VectoMath.InclinationToAngle(1).Value(), 0.000001); } - [TestMethod] + [TestCase] [SuppressMessage("ReSharper", "UnusedVariable")] public void SI_Comparison_Operators() { @@ -223,7 +223,7 @@ namespace TUGraz.VectoCore.Tests.Utils Assert.AreEqual(1, 2.SI().CompareTo(1.SI())); } - [TestMethod] + [TestCase] [SuppressMessage("ReSharper", "UnusedVariable")] public void SI_Test_Addition_Subtraction() { @@ -250,7 +250,7 @@ namespace TUGraz.VectoCore.Tests.Utils "Operator '-' can only operate on SI Objects with the same unit. Got: 1.0000 [s] - 1.0000 [m]"); } - [TestMethod] + [TestCase] public void SI_SpecialUnits() { Scalar scalar = 3.SI<Scalar>(); @@ -309,7 +309,7 @@ namespace TUGraz.VectoCore.Tests.Utils /// <summary> /// VECTO-111 /// </summary> - [TestMethod] + [TestCase] public void SI_ReziprokDivision() { var test = 2.0.SI<Second>(); @@ -320,7 +320,7 @@ namespace TUGraz.VectoCore.Tests.Utils AssertHelper.AreRelativeEqual(expected, actual); } - [TestMethod] + [TestCase] public void SI_Multiplication_Division() { AssertHelper.AreRelativeEqual(12.SI(), 3.SI() * 4.SI()); @@ -353,14 +353,14 @@ namespace TUGraz.VectoCore.Tests.Utils AssertHelper.AreRelativeEqual(second, newtonMeter / watt); } - [TestMethod] + [TestCase] public void SI_MeterPerSecond_Div_Meter() { PerSecond actual = 6.SI<MeterPerSecond>() / 2.SI<Meter>(); AssertHelper.AreRelativeEqual(3.SI().Per.Second, actual); } - [TestMethod] + [TestCase] public void SI_SimplifyUnits() { AssertHelper.AreRelativeEqual(3.SI(), 18.SI().Kilo.Gramm / 6.SI().Kilo.Gramm); @@ -382,14 +382,14 @@ namespace TUGraz.VectoCore.Tests.Utils AssertHelper.AreRelativeEqual(3.SI().Meter.Per.Second, 3.SI<Newton>().Second.Per.Kilo.Gramm); } - [TestMethod] + [TestCase] public void SI_Math() { AssertHelper.AreRelativeEqual(-3, -3.SI().Value()); AssertHelper.AreRelativeEqual(3.SI(), (-3).SI().Abs()); } - [TestMethod] + [TestCase] [SuppressMessage("ReSharper", "ReturnValueOfPureMethodIsNotUsed")] public void SI_Equality() { @@ -427,7 +427,7 @@ namespace TUGraz.VectoCore.Tests.Utils 4.SI<NewtonMeter>().GetHashCode(); } - [TestMethod] + [TestCase] public void SI_Output() { Assert.AreEqual("3.0000", 3.SI().ToOutputFormat()); diff --git a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs index 5b679589e739540f311ef2cbb6c7cc0895c7ddf4..4f7adbf62a85cb6a2c469584121c091bc4fe92e1 100644 --- a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs @@ -32,10 +32,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Windows.Forms; using System.Xml; -using System.Xml.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Resources; @@ -51,10 +48,11 @@ using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.Tests.Utils; using TUGraz.VectoCore.Utils; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.XML { - [TestClass] + [TestFixture] public class XMLDeclarationInputTest { const string SampleVehicleDecl = "TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample.xml"; @@ -63,7 +61,7 @@ namespace TUGraz.VectoCore.Tests.XML const string SampleVehicleFullDeclCertificationOptions = "TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample_certificationOptions.xml"; - [TestMethod] + [TestCase] public void TestXMLInputEng() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -98,7 +96,7 @@ namespace TUGraz.VectoCore.Tests.XML var fldMap = FullLoadCurveReader.Create(fldTable, true); } - [TestMethod] + [TestCase] public void TestXMLInputGbx() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -123,7 +121,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(5000, gears.First().MaxTorque.Value()); } - [TestMethod] + [TestCase] public void TestXMLInputAxlG() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -145,7 +143,7 @@ namespace TUGraz.VectoCore.Tests.XML AssertHelper.Exception<VectoException>(() => { var tmp = axlegearDataProvider.Efficiency; }); } - [TestMethod] + [TestCase] public void TestXMLInputRetarder() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -166,7 +164,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.IsNotNull(lossMap); } - [TestMethod] + [TestCase] public void TestXMLInputAxleWheels() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -185,7 +183,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(31300, axles[1].TyreTestLoad.Value()); } - [TestMethod] + [TestCase] public void TestXMLInputAxleWheelsDuplicates() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -218,7 +216,7 @@ namespace TUGraz.VectoCore.Tests.XML AssertHelper.Exception<VectoException>(() => { var axles = vehicleDataProvider.Axles; }); } - [TestMethod] + [TestCase] public void TestXMLInputAxleWheelsAxleNumTooLow() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -249,7 +247,7 @@ namespace TUGraz.VectoCore.Tests.XML () => { var inputDataProvider = new XMLDeclarationInputDataProvider(modified, true); }); } - [TestMethod] + [TestCase] public void TestXMLInputAxleWheelsAxleNumTooHigh() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -282,7 +280,7 @@ namespace TUGraz.VectoCore.Tests.XML AssertHelper.Exception<VectoException>(() => { var axles = vehicleDataProvider.Axles; }); } - [TestMethod] + [TestCase] public void TestXMLInputAuxiliaries() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -301,7 +299,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("Standard technology - LED headlights, all", aux3.Technology.First()); } - [TestMethod] + [TestCase] public void TestXMLInputADAS() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -313,7 +311,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(DriverMode.Overspeed, adas.OverSpeedEcoRoll.Mode); } - [TestMethod] + [TestCase] public void TestVehicleInput() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -332,7 +330,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(1.0, inputDataProvider.RetarderInputData.Ratio); } - [TestMethod] + [TestCase] public void TestXMLPowertrainGeneration() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -351,7 +349,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(8, jobContainer.Runs.Count); } - [TestMethod] + [TestCase] public void TestFullFeaturedXMEngineering_TorqueConverter() { var reader = XmlReader.Create(SampleVehicleFullDecl); @@ -366,7 +364,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("0.90", tcDataProvider.TCData.Rows[2][1]); } - [TestMethod] + [TestCase] public void TestFullFeaturedXMLDeclaration_AngleDrive() { var reader = XmlReader.Create(SampleVehicleFullDecl); @@ -383,7 +381,7 @@ namespace TUGraz.VectoCore.Tests.XML AssertHelper.Exception<VectoException>(() => { var tmp = angledriveDataProvider.Efficiency; }); } - [TestMethod] + [TestCase] public void TestVehicleInputData() { var reader = XmlReader.Create(SampleVehicleFullDecl); @@ -401,7 +399,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(1.0, inputDataProvider.RetarderInputData.Ratio); } - [TestMethod] + [TestCase] public void TestFullFeaturedXMLDeclaration_TorqueLimits() { var reader = XmlReader.Create(SampleVehicleFullDecl); @@ -416,7 +414,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(12, torqueLimits[2].Gear); } - [TestMethod] + [TestCase] public void TestFullFeaturedXMLDeclaration_GbxTorqueLimits() { var reader = XmlReader.Create(SampleVehicleFullDecl); @@ -431,7 +429,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.IsNull(gears[11].MaxTorque); } - [TestMethod] + [TestCase] public void TestFullFeaturedXMLDeclaration_GbxSpeedLimits() { var reader = XmlReader.Create(SampleVehicleFullDecl); @@ -446,7 +444,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.IsNull(gears[11].MaxInputSpeed); } - [TestMethod] + [TestCase] public void TestElementNotAvailable() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -471,7 +469,7 @@ namespace TUGraz.VectoCore.Tests.XML AssertHelper.Exception<VectoException>(() => { var tmp = inputDataProvider.RetarderInputData.Ratio; }); } - [TestMethod] + [TestCase] public void TestRetarderTypeNone() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -506,7 +504,7 @@ namespace TUGraz.VectoCore.Tests.XML jobContainer.Execute(); } - [TestMethod] + [TestCase] public void TestRetarderTypes() { var retarderTypes = new Dictionary<string, RetarderType>() { @@ -541,7 +539,7 @@ namespace TUGraz.VectoCore.Tests.XML } } - [TestMethod] + [TestCase] public void TestAxleConfigurationTypes() { var axleConfigurations = new Dictionary<string, AxleConfiguration>() { @@ -579,7 +577,7 @@ namespace TUGraz.VectoCore.Tests.XML } } - [TestMethod] + [TestCase] public void TestVehicleCategoryTypes() { var vehicleCategories = new Dictionary<string, VehicleCategory>() { @@ -614,7 +612,7 @@ namespace TUGraz.VectoCore.Tests.XML } - [TestMethod] + [TestCase] public void TestWheelsTypes() { var retarderTypes = new Dictionary<string, RetarderType>() { }; @@ -646,7 +644,7 @@ namespace TUGraz.VectoCore.Tests.XML } } - [TestMethod] + [TestCase] public void TestPTOTypeTypes() { var ptoTypes = new string[][] { @@ -708,7 +706,7 @@ namespace TUGraz.VectoCore.Tests.XML } } - [TestMethod] + [TestCase] public void TestAngledriveTypes() { var angledriveTypes = new Dictionary<string, AngledriveType>() { @@ -743,7 +741,7 @@ namespace TUGraz.VectoCore.Tests.XML } } - [TestMethod] + [TestCase] public void TestGearboxTypes() { var gearboxTypes = new Dictionary<string, GearboxType>() { @@ -782,7 +780,7 @@ namespace TUGraz.VectoCore.Tests.XML } } - [TestMethod] + [TestCase] public void TestPTOInputNone() { var reader = XmlReader.Create(SampleVehicleDecl); @@ -793,7 +791,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("None", ptoDataProvider.PTOTransmissionType); } - [TestMethod] + [TestCase] public void TestPTOInput() { var reader = XmlReader.Create(SampleVehicleFullDecl); @@ -806,7 +804,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(1000, lookup.PowerDemand.Value()); } - [TestMethod] + [TestCase] public void TestCertificationMethodInput() { var reader = XmlReader.Create(SampleVehicleFullDeclCertificationOptions); diff --git a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputRefTest.cs b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputRefTest.cs index 999c06fe8f47f4166af51042b414ed2004f8893d..dac45281122a14233a2e089a2c151327b9824386 100644 --- a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputRefTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputRefTest.cs @@ -1,38 +1,36 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2017 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; using System.Linq; -using System.Xml; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; @@ -45,15 +43,16 @@ using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.Tests.Utils; using TUGraz.VectoCore.Utils; - +using NUnit.Framework; + namespace TUGraz.VectoCore.Tests.XML { - [TestClass] + [TestFixture] public class XMLEngineeringInputRefTest { public const string EngineeringSampleFile = "TestData/XML/XMLReaderEngineering/engineering_job-sample_ref.xml"; - [TestMethod] + [TestCase] public void TestXMLInputEngineeringReferencedFileAsStream() { AssertHelper.Exception<VectoException>(() => { @@ -62,7 +61,7 @@ namespace TUGraz.VectoCore.Tests.XML }); } - [TestMethod] + [TestCase] public void TestXMLInputEngReferencedFile() { var inputDataProvider = new XMLEngineeringInputDataProvider(EngineeringSampleFile, true); @@ -98,7 +97,7 @@ namespace TUGraz.VectoCore.Tests.XML var fldMap = FullLoadCurveReader.Create(fldTable, true); } - [TestMethod] + [TestCase] public void TestXMLInputGbxReferencedFile() { var inputDataProvider = new XMLEngineeringInputDataProvider(EngineeringSampleFile, true); @@ -128,7 +127,7 @@ namespace TUGraz.VectoCore.Tests.XML //var fldMap = FullLoadCurveReader.Create(gears.First().FullLoadCurve, true); } - [TestMethod] + [TestCase] public void TestXMLInputGbxTCReferencedFile() { var inputDataProvider = new XMLEngineeringInputDataProvider(EngineeringSampleFile, true); @@ -146,7 +145,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("0.9", tcInputDataProvider.TCData.Rows[2][2]); } - [TestMethod] + [TestCase] public void TestXMLInputAngledriveReferencedFile() { var inputDataProvider = new XMLEngineeringInputDataProvider(EngineeringSampleFile, true); @@ -163,7 +162,7 @@ namespace TUGraz.VectoCore.Tests.XML var lossMap = TransmissionLossMapReader.Create(lossMapData, angledriveInputData.Ratio, "Angledrive"); } - [TestMethod] + [TestCase] public void TestXMLInputAxlGReferencedFile() { var inputDataProvider = new XMLEngineeringInputDataProvider(EngineeringSampleFile, true); @@ -180,7 +179,7 @@ namespace TUGraz.VectoCore.Tests.XML var lossMap = TransmissionLossMapReader.Create(lossMapData, axlegearDataProvider.Ratio, "AxleGear"); } - [TestMethod] + [TestCase] public void TestXMLInputRetarderReferencedFile() { var inputDataProvider = new XMLEngineeringInputDataProvider(EngineeringSampleFile, true); @@ -198,7 +197,7 @@ namespace TUGraz.VectoCore.Tests.XML var lossMap = RetarderLossMapReader.Create(lossMapData); } - [TestMethod] + [TestCase] public void TestXMLInputAxleWheelsReferencedFile() { var inputDataProvider = new XMLEngineeringInputDataProvider(EngineeringSampleFile, true); @@ -218,7 +217,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(0.488822, vehicleDataProvider.DynamicTyreRadius.Value()); } - [TestMethod] + [TestCase] public void TestXMLInputAuxiliariesReferencedFile() { var inputDataProvider = new XMLEngineeringInputDataProvider(EngineeringSampleFile, true); @@ -239,7 +238,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(3190, aux2.DemandMap.Rows[113].ParseDouble(AuxiliaryDataReader.Fields.SupplyPower)); } - [TestMethod] + [TestCase] public void TestXMLInputADASReferencedFile() { //var reader = XmlReader.Create(EngineeringSampleFile); @@ -251,7 +250,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(DriverMode.Overspeed, adas.OverSpeedEcoRoll.Mode); } - [TestMethod] + [TestCase] public void TestVehicleInputReferencedFile() { var inputDataProvider = new XMLEngineeringInputDataProvider(EngineeringSampleFile, true); @@ -271,7 +270,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(1.0, inputDataProvider.RetarderInputData.Ratio); } - [TestMethod] + [TestCase] public void TestXMLPowertrainGenerationReferencedFile() { var fileWriter = new FileOutputWriter("foo"); @@ -289,7 +288,7 @@ namespace TUGraz.VectoCore.Tests.XML } - [TestMethod] + [TestCase] public void TestXMEngineering_DriverModelLACExt() { var inputDataProvider = new XMLEngineeringInputDataProvider(EngineeringSampleFile, true); @@ -303,7 +302,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("lac_velocityDrop.csv", Path.GetFileName(lac.CoastingDecisionFactorVelocityDropLookup.Source)); } - [TestMethod] + [TestCase] public void TestXMEngineering_PTO() { var inputDataProvider = new XMLEngineeringInputDataProvider(EngineeringSampleFile, true); diff --git a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs index 0d28bcb8b48511ede6cd2a63f058d931479ab878..c2ba4fb6b332ce1215dcd89207d112666ab85cb6 100644 --- a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs @@ -1,39 +1,38 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2017 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; using System.Linq; using System.Xml; using System.Xml.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; @@ -50,10 +49,11 @@ using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.Tests.Utils; using TUGraz.VectoCore.Utils; - +using NUnit.Framework; + namespace TUGraz.VectoCore.Tests.XML { - [TestClass] + [TestFixture] public class XMLEngineeringInputSingleTest { public const string EngineeringSampleFile = "TestData/XML/XMLReaderEngineering/engineering_job-sample.xml"; @@ -61,7 +61,7 @@ namespace TUGraz.VectoCore.Tests.XML public const string EngineeringSampleFileFull = "TestData/XML/XMLReaderEngineering/engineering_job-sample_FULL.xml"; - [TestMethod] + [TestCase] public void TestXMLInputEngSingleFile() { var reader = File.OpenRead(EngineeringSampleFile); @@ -99,7 +99,7 @@ namespace TUGraz.VectoCore.Tests.XML var fldMap = FullLoadCurveReader.Create(fldTable, true); } - [TestMethod] + [TestCase] public void TestXMLInputGbxSingleFile() { var reader = File.OpenRead(EngineeringSampleFile); @@ -128,7 +128,7 @@ namespace TUGraz.VectoCore.Tests.XML } - [TestMethod] + [TestCase] public void TestXMLInputAxlGSingleFile() { var reader = File.OpenRead(EngineeringSampleFile); @@ -147,7 +147,7 @@ namespace TUGraz.VectoCore.Tests.XML var lossMap = TransmissionLossMapReader.Create(lossMapData, axlegearDataProvider.Ratio, "AxleGear"); } - [TestMethod] + [TestCase] public void TestXMLInputAxlGSingleFileEfficiency() { var reader = XmlReader.Create(EngineeringSampleFile); @@ -181,7 +181,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(0.9123, axleGear.Efficiency); } - [TestMethod] + [TestCase] public void TestXMLInputRetarderSingleFile() { var reader = File.OpenRead(EngineeringSampleFile); @@ -201,7 +201,7 @@ namespace TUGraz.VectoCore.Tests.XML var lossMap = RetarderLossMapReader.Create(lossMapData); } - [TestMethod] + [TestCase] public void TestXMLInputAxleWheelsSingleFile() { var reader = File.OpenRead(EngineeringSampleFile); @@ -223,7 +223,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(0.488822, vehicleDataProvider.DynamicTyreRadius.Value()); } - [TestMethod] + [TestCase] public void TestXMLInputAxleWheelsDuplicates() { var reader = XmlReader.Create(EngineeringSampleFile); @@ -261,7 +261,7 @@ namespace TUGraz.VectoCore.Tests.XML AssertHelper.Exception<VectoException>(() => { var axles = vehicleDataProvider.Axles; }); } - [TestMethod] + [TestCase] public void TestXMLInputAxleWheelsAxleNumTooLow() { var reader = XmlReader.Create(EngineeringSampleFile); @@ -298,7 +298,7 @@ namespace TUGraz.VectoCore.Tests.XML }); } - [TestMethod] + [TestCase] public void TestXMLInputAxleWheelsAxleNumTooHigh() { var reader = XmlReader.Create(EngineeringSampleFile); @@ -336,7 +336,7 @@ namespace TUGraz.VectoCore.Tests.XML }); } - [TestMethod] + [TestCase] public void TestXMLInputAuxiliariesSingleFile() { var reader = File.OpenRead(EngineeringSampleFile); @@ -357,7 +357,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("FAN", aux2.ID); } - [TestMethod] + [TestCase] public void TestXMLInputADASSingleFile() { var reader = File.OpenRead(EngineeringSampleFile); @@ -369,7 +369,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(DriverMode.Overspeed, adas.OverSpeedEcoRoll.Mode); } - [TestMethod] + [TestCase] public void TestVehicleInputSingleFile() { var reader = File.OpenRead(EngineeringSampleFile); @@ -391,7 +391,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(1.0, inputDataProvider.RetarderInputData.Ratio); } - [TestMethod] + [TestCase] public void TestXMEngineering_DriverModel() { var reader = File.OpenRead(EngineeringSampleFile); @@ -436,17 +436,17 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(DeclarationData.Gearbox.StartAcceleration.Value(), shiftStrategy.StartAcceleration.Value(), 1e-6); Assert.AreEqual(DeclarationData.Gearbox.TorqueReserveStart, shiftStrategy.StartTorqueReserve, 1e-6); - AssertHelper.AreRelativeEqual(Constants.DefaultPowerShiftTime, shiftStrategy.PowershiftShiftTime); + AssertHelper.AreRelativeEqual(Constants.DefaultPowerShiftTime, shiftStrategy.PowershiftShiftTime); var tcShiftStrategy = inputDataProvider.GearboxInputData.TorqueConverter; - AssertHelper.AreRelativeEqual(DeclarationData.TorqueConverter.CCUpshiftMinAcceleration, - tcShiftStrategy.CCUpshiftMinAcceleration); - AssertHelper.AreRelativeEqual(DeclarationData.TorqueConverter.CLUpshiftMinAcceleration, - tcShiftStrategy.CLUpshiftMinAcceleration); + AssertHelper.AreRelativeEqual(DeclarationData.TorqueConverter.CCUpshiftMinAcceleration, + tcShiftStrategy.CCUpshiftMinAcceleration); + AssertHelper.AreRelativeEqual(DeclarationData.TorqueConverter.CLUpshiftMinAcceleration, + tcShiftStrategy.CLUpshiftMinAcceleration); } - [TestMethod] + [TestCase] public void TestXMEngineering_DriverModelNoAcc() { var reader = XmlReader.Create(EngineeringSampleFile); @@ -482,7 +482,7 @@ namespace TUGraz.VectoCore.Tests.XML } - [TestMethod] + [TestCase] public void TestXMLPowertrainGenerationSingleFile() { var fileWriter = new FileOutputWriter("foo"); @@ -499,7 +499,7 @@ namespace TUGraz.VectoCore.Tests.XML //Assert.AreEqual(6, jobContainer.Runs.Count); } - [TestMethod] + [TestCase] public void TestFullFeaturedXMEngineering_TorqueConverter() { var reader = File.OpenRead(EngineeringSampleFileFull); @@ -522,7 +522,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(1700, tcDataProvider.MaxInputSpeed.AsRPM, 1e-6); } - [TestMethod] + [TestCase] public void TestFullFeaturedXMEngineering_AngleDrive() { var reader = File.OpenRead(EngineeringSampleFileFull); @@ -537,7 +537,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("100.00", angledriveDataProvider.LossMap.Rows[4][2]); } - [TestMethod] + [TestCase] public void TestFullFeaturedXMEngineering_DriverModel() { var reader = File.OpenRead(EngineeringSampleFileFull); @@ -593,7 +593,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(0.133, tcShiftStrategy.CLUpshiftMinAcceleration.Value(), 1e-6); } - [TestMethod] + [TestCase] public void TestFullFeaturedXMEngineering_CrosswindCorrection() { var reader = File.OpenRead(EngineeringSampleFileFull); @@ -607,7 +607,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("1.8", airdragData.CrosswindCorrectionMap.Rows[1][1]); } - [TestMethod] + [TestCase] public void TestFullFeaturedXMEngineering_PTO() { var reader = File.OpenRead(EngineeringSampleFileFull); @@ -628,7 +628,7 @@ namespace TUGraz.VectoCore.Tests.XML } - [TestMethod] + [TestCase] public void TestXMLInputAngledriveGSingleFile() { var reader = File.OpenRead(EngineeringSampleFileFull); @@ -647,7 +647,7 @@ namespace TUGraz.VectoCore.Tests.XML var lossMap = TransmissionLossMapReader.Create(lossMapData, angledriveInputData.Ratio, "Angledrive"); } - [TestMethod] + [TestCase] public void TestXMLInputAngledriveSingleFileEfficiency() { var reader = XmlReader.Create(EngineeringSampleFileFull); @@ -681,7 +681,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(0.9124, angledrive.Efficiency); } - [TestMethod] + [TestCase] public void TestXMLInputConstantAuxSingleFile() { var reader = XmlReader.Create(EngineeringSampleFileFull); @@ -720,7 +720,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(5000, auxInput[0].ConstantPowerDemand.Value(), 1e-6); } - [TestMethod] + [TestCase] public void TestRetarderTypeNone() { var reader = XmlReader.Create(EngineeringSampleFile); @@ -774,7 +774,7 @@ namespace TUGraz.VectoCore.Tests.XML jobContainer.Execute(); } - [TestMethod] + [TestCase] public void TestXMLInputInvalidXML() { var reader = XmlReader.Create(EngineeringSampleFileFull); @@ -805,7 +805,7 @@ namespace TUGraz.VectoCore.Tests.XML } - [TestMethod] + [TestCase] public void TestXMLInputInvalidCycle() { var reader = XmlReader.Create(EngineeringSampleFileFull); @@ -841,7 +841,7 @@ namespace TUGraz.VectoCore.Tests.XML }); } - [TestMethod] + [TestCase] public void TestXMLInputInvalidDriverAcceleration() { var reader = XmlReader.Create(EngineeringSampleFileFull); @@ -877,7 +877,7 @@ namespace TUGraz.VectoCore.Tests.XML }); } - [TestMethod] + [TestCase] public void TestXMLInputExtResourceMissingTag() { var reader = XmlReader.Create(EngineeringSampleFileFull); diff --git a/VectoCore/VectoCoreTest/XML/XMLWritingTest.cs b/VectoCore/VectoCoreTest/XML/XMLWritingTest.cs index 5b200959dbcac2b69c609779fe1065754edbf601..402bebd9a09aa76ef10abd7cc18385d99a150113 100644 --- a/VectoCore/VectoCoreTest/XML/XMLWritingTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLWritingTest.cs @@ -31,17 +31,16 @@ using System.IO; using System.Xml; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.IVT.VectoXML.Writer; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCore.InputData.FileIO.JSON; using TUGraz.VectoCore.InputData.FileIO.XML.Declaration; using TUGraz.VectoCore.InputData.FileIO.XML.Engineering; using TUGraz.VectoCore.OutputData.XML; +using NUnit.Framework; namespace TUGraz.VectoCore.Tests.XML { - [TestClass] + [TestFixture] public class XMLWritingTests { const string EngineOnlyJob = @"TestData\XML\EngineOnlyJob\EngineOnly.vecto"; @@ -56,7 +55,7 @@ namespace TUGraz.VectoCore.Tests.XML @"TestData\XML\XMLWriter\DeclarationJob\Class5_Tractor_4x2\Class5_Tractor_DECL-FULL.vecto"; - [TestMethod] + [TestCase] public void TestWriteEngineOnlySingleFile() { var outFile = "EngineOnlyJobSingleFile.xml"; @@ -77,7 +76,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("175kW 6.8l Engine", xml.JobInputData().JobName); } - [TestMethod] + [TestCase] public void TestWriteEngineeringSingleFile() { var outFile = "EngineeringJobSingleFile.xml"; @@ -93,7 +92,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("VEH-N.A.", xml.JobInputData().JobName); } - [TestMethod] + [TestCase] public void TestWriteEngineeringSingleFileFull() { var outFile = "EngineeringJobSingleFileFull.xml"; @@ -109,7 +108,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("VEH-N.A.", xml.JobInputData().JobName); } - [TestMethod] + [TestCase] public void TestWriteEngineeringMultipleFilesFull() { var outFile = "EngineeringJobMultipleFilesFull.xml"; @@ -127,7 +126,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("VEH-N.A.", xml.JobInputData().JobName); } - [TestMethod] + [TestCase] public void TestWriteEngineeringMultipleFiles() { var inputData = JSONInputDataFactory.ReadJsonJob(EngineeringJob); @@ -143,7 +142,7 @@ namespace TUGraz.VectoCore.Tests.XML //Assert.AreEqual("VEH-N/A", xml.JobInputData().JobName); } - [TestMethod] + [TestCase] public void TestWriteDeclarationJob() { var outputFile = "DeclarationJobSingleFile.xml"; @@ -165,7 +164,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual("VEH-N.A.", xml.JobInputData().JobName); } - [TestMethod] + [TestCase] public void TestWriteDeclarationJobFull() { var outputFile = "DeclarationJobFullSingleFile.xml";