コード例 #1
0
ファイル: Static.cs プロジェクト: zlzforever/AutoCSer
        /// <summary>
        /// 支持公共函数测试
        /// </summary>
        /// <returns></returns>
        //[AutoCSer.Metadata.TestMethod]
        internal static bool TestCase()
        {
            using (AutoCSer.Example.TcpInternalServer.Static.TcpInternalServer server = new AutoCSer.Example.TcpInternalServer.Static.TcpInternalServer())
            {
                if (server.IsListen)
                {
                    using (AutoCSer.Example.TcpInternalServer.Static.TcpInternalClient client = new AutoCSer.Example.TcpInternalServer.Static.TcpInternalClient())
                    {
                        AutoCSer.Net.TcpServer.ReturnValue <int> sum = client.Add(2, 3);
                        if (sum.Type != AutoCSer.Net.TcpServer.ReturnType.Success || sum.Value != 2 + 3)
                        {
                            return(false);
                        }

                        #region Awaiter.Wait()
                        sum = client.AddAwaiter(2, 3).Wait().Result;
                        if (sum.Type != Net.TcpServer.ReturnType.Success || sum.Value != 2 + 3)
                        {
                            return(false);
                        }
                        #endregion

                        return(true);
                    }
                }
            }
            return(false);
        }
コード例 #2
0
ファイル: Static.cs プロジェクト: W8023Y2014/AutoCSer
 /// <summary>
 /// 支持公共函数测试
 /// </summary>
 /// <returns></returns>
 //[AutoCSer.Metadata.TestMethod]
 internal static bool TestCase()
 {
     using (AutoCSer.Example.TcpInternalServer.Static.TcpInternalServer server = new AutoCSer.Example.TcpInternalServer.Static.TcpInternalServer())
     {
         if (server.IsListen)
         {
             using (AutoCSer.Example.TcpInternalServer.Static.TcpInternalClient client = new AutoCSer.Example.TcpInternalServer.Static.TcpInternalClient())
             {
                 AutoCSer.Net.TcpServer.ReturnValue <int> sum = client.Add(2, 3);
                 return(sum.Type == AutoCSer.Net.TcpServer.ReturnType.Success && sum.Value == 2 + 3);
             }
         }
     }
     return(false);
 }