Exemplo n.º 1
0
        public void Converter_ReadsJson()
        {
            string         json  = "{\"updatedAt\":\"2021-08-21T12:30:15.123+00:00\"}";
            DateTimeOffset value = DateTimeOffset.Parse("2021-08-21T12:30:15.123+00:00");

            DTOIdEntity entity = JsonConvert.DeserializeObject <DTOIdEntity>(json, _settings);

            AssertEx.CloseTo(value, entity.UpdatedAt.Value);
        }
Exemplo n.º 2
0
        public void Converter_WritesJson_WithTimeZone()
        {
            string      json   = "{\"UpdatedAt\":\"2021-08-21T12:30:15.123+00:00\",\"Number\":0}";
            DTOIdEntity entity = new DTOIdEntity()
            {
                UpdatedAt = DateTimeOffset.Parse("2021-08-21T20:30:15.1234567+08:00")
            };
            string actual = JsonConvert.SerializeObject(entity, _settings);

            Assert.Equal(json, actual);
        }