Example #1
0
        public void TestWrite()
        {
            JsonSerializerOptions options = new JsonSerializerOptions().SetupExtensions();

            const string json = @"{""Id"":12,""Nullable1"":13,""Nullable2"":null}";
            var          obj  = new ObjectWithNullable
            {
                Id        = 12,
                Nullable1 = 13
            };

            Helper.TestWrite(obj, json, options);
        }
        public void TestWrite()
        {
            CborOptions options = new CborOptions();

            const string hexBuffer = "A36249640C694E756C6C61626C65310D694E756C6C61626C6532F6";
            var          obj       = new ObjectWithNullable
            {
                Id        = 12,
                Nullable1 = 13
            };

            Helper.TestWrite(obj, hexBuffer, null, options);
        }
Example #3
0
        public void TestWriteIgnoreNullValues()
        {
            JsonSerializerOptions options = new JsonSerializerOptions
            {
                IgnoreNullValues = true
            }.SetupExtensions();

            const string json = @"{""Id"":12,""Nullable1"":13}";
            var          obj  = new ObjectWithNullable
            {
                Id        = 12,
                Nullable1 = 13
            };

            Helper.TestWrite(obj, json, options);
        }