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

Skip to content
Snippets Groups Projects
Commit 116fced7 authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

adding testcase for hash calculation VIF primary and multistage

parent 61de3925
No related branches found
No related tags found
No related merge requests found
......@@ -79,7 +79,7 @@ namespace TUGraz.VectoCommon.Hashing
case VectoComponents.VectoCustomerInformation:
return "VectoCustomerInformation";
case VectoComponents.VectoPrimaryVehicleInformation:
return "VectoOutputPrimaryVehicle";
return "PrimaryVehicle";
case VectoComponents.VectoManufacturingStage:
return "ManufacturingStage";
default:
......
......@@ -32,6 +32,7 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Text;
using System.Xml;
using System.Xml.XPath;
......@@ -523,5 +524,75 @@ namespace VectoHashingTest
var h = VectoHash.Load(file);
Assert.IsTrue(h.ValidateHash());
}
public const string MultistageFile =
@"Testdata\XML\Multistage\vecto_multistage_primary_vehicle_stage_2_3_group41.xml";
[TestCase(MultistageFile)]
public void TestMultistageComputeHashPrimary(string file)
{
var h = VectoHash.Load(file);
var primaryHash = h.ComputeHash(VectoComponents.VectoPrimaryVehicleInformation);
Assert.AreEqual("VTu71FU/Sijqk2Z8sScROGolObZK/UNTycf4K2CAgEs=", primaryHash);
}
[TestCase(MultistageFile)]
public void TestMultistageReadHashPrimary(string file)
{
var h = VectoHash.Load(file);
var existingHash = h.ReadHash(VectoComponents.VectoPrimaryVehicleInformation);
Assert.AreEqual("VTu71FU/Sijqk2Z8sScROGolObZK/UNTycf4K2CAgEs=", existingHash);
}
[TestCase(MultistageFile)]
public void TestMultistageComputeInterimStage2(string file)
{
var h = VectoHash.Load(file);
var primaryHash = h.ComputeHash(VectoComponents.VectoManufacturingStage, 0);
Assert.AreEqual("Muaefd8RS+EjtmMVbSejxbSy5Tgcpm/WqnoLk+YH8ho=", primaryHash);
}
[TestCase(MultistageFile)]
public void TestMultistageComputeInterimStage3(string file)
{
var h = VectoHash.Load(file);
var primaryHash = h.ComputeHash(VectoComponents.VectoManufacturingStage, 1);
Assert.AreEqual("l7Z22F1bPMaAD4+0WNY+cahbjDKE80gxYv6K91YTMcU=", primaryHash);
}
[TestCase(MultistageFile)]
public void TestMultistageReadInterimStage2(string file)
{
var h = VectoHash.Load(file);
var primaryHash = h.ReadHash(VectoComponents.VectoManufacturingStage, 0);
Assert.AreEqual("Muaefd8RS+EjtmMVbSejxbSy5Tgcpm/WqnoLk+YH8ho=", primaryHash);
}
[TestCase(MultistageFile)]
public void TestMultistageReadInterimStage3(string file)
{
var h = VectoHash.Load(file);
var primaryHash = h.ReadHash(VectoComponents.VectoManufacturingStage, 1);
Assert.AreEqual("l7Z22F1bPMaAD4+0WNY+cahbjDKE80gxYv6K91YTMcU=", primaryHash);
}
}
}
......@@ -68,6 +68,9 @@
<Content Include="Testdata\XML\Invalid\invalid-comp.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Testdata\XML\Multistage\vecto_multistage_primary_vehicle_stage_2_3_group41.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Testdata\XML\Reference\vecto_engine-sample.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
......@@ -186,6 +189,7 @@
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment