Ejemplo n.º 1
0
        public void PropertyWithDefiniteLengthAttribute()
        {
            CborOptions options = new CborOptions
            {
                ArrayLengthMode = LengthMode.IndefiniteLength
            };

            ObjectWithPropertyWithDefiniteAttribute obj = new ObjectWithPropertyWithDefiniteAttribute
            {
                List = new List <int> {
                    1, 2, 3
                }
            };

            const string hexBuffer = "A1644C69737483010203";

            Helper.TestWrite(obj, hexBuffer, null, options);
        }
        public void PropertyWithDefiniteLengthAttribute()
        {
            CborOptions options = new CborOptions
            {
                MapLengthMode = LengthMode.IndefiniteLength
            };

            ObjectWithPropertyWithDefiniteAttribute obj = new ObjectWithPropertyWithDefiniteAttribute
            {
                Dictionary = new Dictionary <int, string>
                {
                    { 1, "foo" },
                    { 2, "bar" }
                }
            };

            const string hexBuffer = "BF6A44696374696F6E617279A20163666F6F0263626172FF";

            Helper.TestWrite(obj, hexBuffer, null, options);
        }
Ejemplo n.º 3
0
        public void PropertyWithDefiniteLengthAttribute()
        {
            CborOptions options = new CborOptions
            {
                MapLengthMode = LengthMode.IndefiniteLength
            };

            ObjectWithPropertyWithDefiniteAttribute obj = new ObjectWithPropertyWithDefiniteAttribute
            {
                Object = new Object
                {
                    Id   = 12,
                    Name = "foo"
                }
            };

            const string hexBuffer = "BF664F626A656374A26249640C644E616D6563666F6FFF";

            Helper.TestWrite(obj, hexBuffer, null, options);
        }