public static compareTLV ( |
||
expected | ||
result | ||
return | void |
public static void compareTLV(TLV expected, TLV result)
{
Assert.AreEqual(expected.Length, result.Length);
Assert.AreEqual(expected.Tag, result.Tag);
Assert.AreEqual(expected.Value, result.Value);
// if has a child then traverse to make sure all the child is the same
if (expected.child != null)
{
compareListTLV(expected.child, result.child);
}
}
public void TLV_Normal_GrandChild() { var testData = "GG088106980484028899"; TLV grandParent = new TLV() { Tag = "GG", Length = 8, Value = "8106980484028899" }; TLV parent = new TLV() { Tag = "81", Length = 6, Value = "980484028899" }; grandParent.addChild(parent); TLV child = new TLV() { Tag = "98", Length = 4, Value = "84028899" }; parent.addChild(child); TLV grandChild = new TLV() { Tag = "84", Length = 2, Value = "8899" }; child.addChild(grandChild); TLV result = TLV.parse(testData); Helper.compareTLV(grandParent, result); }