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

            options.SetupExtensions();

            const string json = @"{""Guid"":""67ebf45d016c4b488ae61e389127b717""}";
            ObjectWithCustomConverterOnProperty obj = Helper.Read <ObjectWithCustomConverterOnProperty>(json, options);

            Assert.NotNull(obj);
            Assert.Equal(Guid.Parse("67EBF45D-016C-4B48-8AE6-1E389127B717"), obj.Guid);
        }
Ejemplo n.º 2
0
        public void WriteWithCustomConverterOnProperty()
        {
            JsonSerializerOptions options = new JsonSerializerOptions();

            options.SetupExtensions();

            const string json = @"{""Guid"":""67ebf45d016c4b488ae61e389127b717""}";
            ObjectWithCustomConverterOnProperty obj = new ObjectWithCustomConverterOnProperty
            {
                Guid = Guid.Parse("67EBF45D-016C-4B48-8AE6-1E389127B717")
            };

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