向nuget发布8.7.2020.0308、9.16.2020.0308
大石头 编写于 2020-03-08 22:22:53
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"]);
        }
    }
}