public void ReadWithDictionary()
        {
            const string     hexBuffer = "A46D496E7444696374696F6E617279A2010102026E55496E7444696374696F6E617279A201A168496E7456616C75650102A168496E7456616C75650270537472696E6744696374696F6E617279A2613182A168496E7456616C75650BA168496E7456616C75650C613282A168496E7456616C756515A168496E7456616C7565166E456E756D44696374696F6E617279A26656616C756531A201A168496E7456616C75650B02A168496E7456616C75650C6656616C756532A201A168496E7456616C75651502A168496E7456616C756516";
            DictionaryObject obj       = Helper.Read <DictionaryObject>(hexBuffer);

            Assert.NotNull(obj);

            Assert.NotNull(obj.IntDictionary);
            Assert.Equal(2, obj.IntDictionary.Count);
            Assert.True(obj.IntDictionary.ContainsKey(1));
            Assert.Equal(1, obj.IntDictionary[1]);
            Assert.True(obj.IntDictionary.ContainsKey(2));
            Assert.Equal(2, obj.IntDictionary[2]);

            Assert.NotNull(obj.UIntDictionary);
            Assert.Equal(2, obj.UIntDictionary.Count);
            Assert.True(obj.UIntDictionary.ContainsKey(1));
            Assert.NotNull(obj.UIntDictionary[1]);
            Assert.Equal(1, obj.UIntDictionary[1].IntValue);
            Assert.True(obj.UIntDictionary.ContainsKey(2));
            Assert.NotNull(obj.UIntDictionary[2]);
            Assert.Equal(2, obj.UIntDictionary[2].IntValue);

            Assert.NotNull(obj.StringDictionary);
            Assert.Equal(2, obj.StringDictionary.Count);
            Assert.True(obj.StringDictionary.ContainsKey("1"));
            Assert.NotNull(obj.StringDictionary["1"]);
            Assert.Equal(2, obj.StringDictionary["1"].Count);
            Assert.Equal(11, obj.StringDictionary["1"][0].IntValue);
            Assert.Equal(12, obj.StringDictionary["1"][1].IntValue);
            Assert.True(obj.StringDictionary.ContainsKey("2"));
            Assert.NotNull(obj.StringDictionary["2"]);
            Assert.Equal(2, obj.StringDictionary["2"].Count);
            Assert.Equal(21, obj.StringDictionary["2"][0].IntValue);
            Assert.Equal(22, obj.StringDictionary["2"][1].IntValue);

            Assert.NotNull(obj.EnumDictionary);
            Assert.Equal(2, obj.EnumDictionary.Count);
            Assert.True(obj.EnumDictionary.ContainsKey(EnumTest.Value1));
            Assert.NotNull(obj.EnumDictionary[EnumTest.Value1]);
            Assert.Equal(2, obj.EnumDictionary[EnumTest.Value1].Count);
            Assert.Equal(11, obj.EnumDictionary[EnumTest.Value1][1].IntValue);
            Assert.Equal(12, obj.EnumDictionary[EnumTest.Value1][2].IntValue);
            Assert.True(obj.EnumDictionary.ContainsKey(EnumTest.Value2));
            Assert.NotNull(obj.EnumDictionary[EnumTest.Value2]);
            Assert.Equal(2, obj.EnumDictionary[EnumTest.Value2].Count);
            Assert.Equal(21, obj.EnumDictionary[EnumTest.Value2][1].IntValue);
            Assert.Equal(22, obj.EnumDictionary[EnumTest.Value2][2].IntValue);
        }
        public void WriteWithDictionary()
        {
            const string hexBuffer = "A46D496E7444696374696F6E617279A2010102026E55496E7444696374696F6E617279A201A168496E7456616C75650102A168496E7456616C75650270537472696E6744696374696F6E617279A2613182A168496E7456616C75650BA168496E7456616C75650C613282A168496E7456616C756515A168496E7456616C7565166E456E756D44696374696F6E617279A26656616C756531A201A168496E7456616C75650B02A168496E7456616C75650C6656616C756532A201A168496E7456616C75651502A168496E7456616C756516";

            DictionaryObject obj = new DictionaryObject
            {
                IntDictionary = new Dictionary <int, int>
                {
                    { 1, 1 },
                    { 2, 2 }
                },
                UIntDictionary = new Dictionary <uint, IntObject>
                {
                    { 1, new IntObject {
                          IntValue = 1
                      } },
                    { 2, new IntObject {
                          IntValue = 2
                      } }
                },
                StringDictionary = new Dictionary <string, List <IntObject> >
                {
                    { "1", new List <IntObject> {
                          new IntObject {
                              IntValue = 11
                          }, new IntObject {
                              IntValue = 12
                          }
                      } },
                    { "2", new List <IntObject> {
                          new IntObject {
                              IntValue = 21
                          }, new IntObject {
                              IntValue = 22
                          }
                      } }
                },
                EnumDictionary = new Dictionary <EnumTest, Dictionary <int, IntObject> >
                {
                    {
                        EnumTest.Value1, new Dictionary <int, IntObject>
                        {
                            { 1, new IntObject {
                                  IntValue = 11
                              } },
                            { 2, new IntObject {
                                  IntValue = 12
                              } }
                        }
                    },
                    {
                        EnumTest.Value2, new Dictionary <int, IntObject>
                        {
                            { 1, new IntObject {
                                  IntValue = 21
                              } },
                            { 2, new IntObject {
                                  IntValue = 22
                              } }
                        }
                    }
                }
            };

            Helper.TestWrite(obj, hexBuffer, null,
                             new CborOptions {
                EnumFormat = ValueFormat.WriteToString
            });
        }