Ejemplo n.º 1
0
        public void ReadWithJsonPropertyName()
        {
            JsonSerializerOptions options = new JsonSerializerOptions();

            options.SetupExtensions();

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

            Assert.NotNull(obj);
            Assert.Equal(12, obj.Id);
        }
Ejemplo n.º 2
0
        public void WriteWithJsonPropertyName()
        {
            JsonSerializerOptions options = new JsonSerializerOptions();

            options.SetupExtensions();

            const string json = @"{""id"":12}";

            ObjectWithJsonPropertyName obj = new ObjectWithJsonPropertyName
            {
                Id = 12
            };

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