/// <summary> /// Tcp服务端抽象类 /// </summary> public TcpServerBase() { this.AllSessions = new SessionCollection <T>(); this.ExtraState = new ServerExtraState( () => this.freeSessionQueue.Count, () => this.totalSessionCount, () => this.acceptFailureTimes); }
public void TotalSessionCountTest() { Func<int> getFreeSessionCountFunc = null; // TODO: 初始化为适当的值 Func<int> getTotalSessionCountFunc = () => 2; // TODO: 初始化为适当的值 ServerExtraState target = new ServerExtraState(getFreeSessionCountFunc, getTotalSessionCountFunc, null); // TODO: 初始化为适当的值 int actual; actual = target.TotalSessionCount; Assert.IsTrue(actual == 2); }