Ejemplo n.º 1
0
        public void TestDecodeBinaryWithOffset()
        {
            CompositeField dec = new CompositeField()
                                 .AddParser(new LlvarParseInfo())
                                 .AddParser(new NumericParseInfo(5))
                                 .AddParser(new AlphaParseInfo(1));
            int            offset = 5;
            CompositeField f      = (CompositeField)dec.DecodeBinaryField(binaryData, offset, binaryData.Length - offset);

            Assert.NotNull(f);
            Assert.Equal(3, f.Values.Count);
            Assert.Equal("Two", f.Values[0].Value);
            Assert.Equal(999L, f.Values[1].Value);
            Assert.Equal("X", f.Values[2].Value);
        }
Ejemplo n.º 2
0
        public void TestDecodeBinary()
        {
            CompositeField dec = new CompositeField()
                                 .AddParser(new AlphaParseInfo(5))
                                 .AddParser(new LlvarParseInfo())
                                 .AddParser(new NumericParseInfo(5))
                                 .AddParser(new AlphaParseInfo(1));

            CompositeField f = (CompositeField)dec.DecodeBinaryField(binaryData, 0, binaryData.Length);

            Assert.NotNull(f);
            Assert.Equal(4, f.Values.Count);
            Assert.Equal("One  ", f.Values[0].Value);
            Assert.Equal("Two", f.Values[1].Value);
            Assert.Equal(999L, f.Values[2].Value);
            Assert.Equal("X", f.Values[3].Value);
        }