经过两天修正,足够稳定,发布0204,希望作为LTS版本
大石头 authored at 2020-02-04 22:44:36
1.54 KiB
X
using System;
using System.Collections.Generic;
using System.Text;
using XCode.Membership;
using Xunit;

namespace XUnitTest.XCode.Configuration
{
    public class FieldTests
    {
        [Fact(DisplayName = "基础测试")]
        public void BasicTest()
        {
            var fi = UserX._.Password;
            Assert.Equal("Password", fi.Name);
            Assert.Equal("密码", fi.DisplayName);
            Assert.Equal("密码", fi.Description);
            Assert.Equal(typeof(String), fi.Type);
            Assert.False(fi.IsIdentity);
            Assert.False(fi.PrimaryKey);
            Assert.False(fi.Master);
            Assert.True(fi.IsNullable);
            Assert.Equal(50, fi.Length);
            Assert.True(fi.IsDataObjectField);
            Assert.False(fi.IsDynamic);
            Assert.Equal("Password", fi.ColumnName);
            Assert.False(fi.ReadOnly);
            Assert.NotNull(fi.Table);
            Assert.NotNull(fi.Field);
            Assert.NotNull(fi.Factory);
            Assert.Equal("Password", fi.FormatedName);
            Assert.Null(fi.OriField);
            Assert.Null(fi.Map);

            Assert.True(UserX._.ID.IsIdentity);
            Assert.True(UserX._.ID.PrimaryKey);
            Assert.True(UserX._.Name.Master);
            Assert.False(UserX._.Name.IsNullable);

            fi = UserX.Meta.Table.FindByName("DepartmentName");
            Assert.NotNull(fi);
            Assert.NotNull(fi.OriField);
            Assert.Equal("DepartmentID", fi.OriField.Name);
            Assert.NotNull(fi.Map);
        }
    }
}