Esempio n. 1
0
        public void ReadWithObject()
        {
            JsonSerializerOptions options = new JsonSerializerOptions();

            options.SetupExtensions();

            const string     json = @"{""Object"":{""IntValue"":12}}";
            ObjectWithObject obj  = Helper.Read <ObjectWithObject>(json, options);

            Assert.NotNull(obj);
            Assert.NotNull(obj.Object);
            Assert.Equal(12, obj.Object.IntValue);
        }
Esempio n. 2
0
        public void WriteWithObject()
        {
            JsonSerializerOptions options = new JsonSerializerOptions();

            options.SetupExtensions();

            const string json = @"{""Object"":{""IntValue"":12}}";

            ObjectWithObject obj = new ObjectWithObject
            {
                Object = new IntObject
                {
                    IntValue = 12
                }
            };

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