v10.10.2024.0601 优化Json序列化,支持DateOnly/TimeOnly,支持带时区的时间序列化
石头 编写于 2024-06-01 08:10:50
X
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XCode.Membership;
using Xunit;
using NewLife.Serialization;

namespace XUnitTest.XCode.EntityTests
{
    public class EntityExtendTests
    {
        [Fact]
        public void ExtendJson()
        {
            var role = Role.FindAllWithCache().FirstOrDefault();
            role["aaa"] = "bbb";

            var json = role.ToJson(true, true, false);
            Assert.Contains("\"aaa\": \"bbb\"", json);

            var role2 = json.ToJsonEntity<Role>();
            Assert.Equal("bbb", role2["aaa"]);
        }
    }
}