public void UnhandledNameTest(string hexBuffer)
        {
            IntObject obj = Helper.Read <IntObject>(hexBuffer);

            Assert.NotNull(obj);
            Assert.Equal(1, obj.IntValue);
        }
Пример #2
0
        public void ReadWithNamingConvention()
        {
            CborOptions options = new CborOptions();

            options.Registry.ObjectMappingRegistry.Register <IntObject>(objectMapping =>
                                                                        objectMapping
                                                                        .AutoMap()
                                                                        .SetNamingConvention(new CamelCaseNamingConvention())
                                                                        );

            const string hexBuffer = "A168696E7456616C75650C";
            IntObject    obj       = Helper.Read <IntObject>(hexBuffer, options);

            Assert.NotNull(obj);
            Assert.Equal(12, obj.IntValue);
        }
Пример #3
0
        public void WriteWithNamingConvention()
        {
            CborOptions options = new CborOptions();

            options.Registry.ObjectMappingRegistry.Register <IntObject>(objectMapping =>
                                                                        objectMapping
                                                                        .AutoMap()
                                                                        .SetNamingConvention(new CamelCaseNamingConvention())
                                                                        );

            IntObject obj = new IntObject
            {
                IntValue = 12
            };

            const string hexBuffer = "A168696E7456616C75650C";

            Helper.TestWrite(obj, hexBuffer, null, options);
        }
 protected bool Equals(IntObject other)
 {
     return(IntValue == other.IntValue);
 }