[fix]修正UdpServer在接收广播时连续启动接收的错误,在StarAgent中,此时可能收到广播包,SocketFlags是Broadcast,需要清空,否则报错“参考的对象类型不支持尝试的操作”; 无需设置SocketOptionName.PacketInformation,在ReceiveMessageFromAsync时会自动设置,并且支持ipv6;
石头 编写于 2024-10-10 00:36:00 石头 提交于 2024-10-10 00:45:43
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 = User._.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(200, 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(User._.ID.IsIdentity);
            Assert.True(User._.ID.PrimaryKey);
            Assert.True(User._.Name.Master);
            Assert.False(User._.Name.IsNullable);

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