引入redis服务,支持自动化单元测试
大石头 编写于 2022-03-31 22:56:30
X
using NewLife.Log;
using NewLife.Net;
using Xunit;

namespace XUnitTest.Net
{
    public class TcpConnectionInformation2Tests
    {
        [Fact]
        public void GetAllTcp()
        {
            var tcps = TcpConnectionInformation2.GetAllTcpConnections();
            Assert.NotNull(tcps);
            Assert.True(tcps.Length > 0);
            Assert.Contains(tcps, e => e.ProcessId > 0);

            foreach (var item in tcps)
            {
                XTrace.WriteLine("{0}\t{1}\t{2}\t{3}", item.LocalEndPoint, item.RemoteEndPoint, item.State, item.ProcessId);
            }
        }
    }
}