From 4ec0347c9b21ac0f6e1a713b667a8d521eaf32df Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <quaritsch@ivt.tugraz.at> Date: Thu, 1 Dec 2022 16:58:02 +0100 Subject: [PATCH] adapt hashing test for changes in hashing method --- VectoCommon/VectoCommon/Hashing/VectoComponents.cs | 2 ++ VectoCommon/VectoHashingTest/VectoHashTest.cs | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/VectoCommon/VectoCommon/Hashing/VectoComponents.cs b/VectoCommon/VectoCommon/Hashing/VectoComponents.cs index abc1aff1bf..a3cd83653f 100644 --- a/VectoCommon/VectoCommon/Hashing/VectoComponents.cs +++ b/VectoCommon/VectoCommon/Hashing/VectoComponents.cs @@ -104,6 +104,8 @@ namespace TUGraz.VectoCommon.Hashing return XMLNames.Component_CertifiedAeroReduction; case VectoComponents.ElectricEnergyStorage: return XMLNames.REESS; + case VectoComponents.VectoInterimVehicleInformation: + return "InterimVehicle"; default: throw new ArgumentOutOfRangeException("VectoComponents", component, null); } diff --git a/VectoCommon/VectoHashingTest/VectoHashTest.cs b/VectoCommon/VectoHashingTest/VectoHashTest.cs index afffeaa4e6..ce2fdff3a7 100644 --- a/VectoCommon/VectoHashingTest/VectoHashTest.cs +++ b/VectoCommon/VectoHashingTest/VectoHashTest.cs @@ -743,12 +743,12 @@ namespace VectoHashingTest var variationValid = h2.ValidateHash(); Assert.IsTrue(variationValid); - var message = ""; - var validatorV = new XMLValidator(xmlDocV, validationErrorAction: (s, ve) => message = ve.Exception.Message); + var validatorV = new XMLValidator(xmlDocV, validationErrorAction: (s, ve) => {}); var result = validatorV.ValidateXML(XmlDocumentType.DeclarationComponentData); Assert.IsFalse(result); - Assert.IsTrue(message.Contains("Invalid tyre dimension")); + Assert.NotNull(validatorV.ValidationError); + Assert.IsTrue(validatorV.ValidationError.Contains("Invalid tyre dimension")); } [ @@ -798,13 +798,12 @@ namespace VectoHashingTest xmlDoc.Load(modified); var h = VectoHash.Load(xmlDoc); var hashed = h.AddHash(); - string message = ""; var validator = new XMLValidator(XmlReader.Create(new StringReader(hashed.ToString())), - validationErrorAction: (s, ve) => message = ve.Exception.Message); + validationErrorAction: (s, ve) => { }); var result = validator.ValidateXML(XmlDocumentType.DeclarationComponentData); Assert.IsFalse(result); - Assert.IsTrue(message.Contains("Invalid tyre dimension")); + Assert.IsTrue(validator.ValidationError.Contains("Invalid tyre dimension")); } private XmlReader GetModifiedXML(XDocument doc, string dimension) -- GitLab