APDUTest.Helper.compareTLV C# (CSharp) Метод

compareTLV() публичный статический Метод

public static compareTLV ( TLV expected, TLV result ) : void
expected ParserLib.TLV
result ParserLib.TLV
Результат 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);
            }
        }

Usage Example

Пример #1
0
        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);
        }
All Usage Examples Of APDUTest.Helper::compareTLV