Esempio n. 1
0
        /// <summary>
        /// 无需 TCP 远程函数申明配置测试
        /// </summary>
        /// <returns></returns>
        //[AutoCSer.Metadata.TestMethod]
        internal static bool TestCase()
        {
            using (AutoCSer.Example.TcpOpenServer.NoAttribute.TcpOpenServer server = new AutoCSer.Example.TcpOpenServer.NoAttribute.TcpOpenServer())
            {
                if (server.IsListen)
                {
                    using (AutoCSer.Example.TcpOpenServer.TcpClient.NoAttribute.TcpOpenClient client = new AutoCSer.Example.TcpOpenServer.TcpClient.NoAttribute.TcpOpenClient())
                    {
                        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);
        }
Esempio n. 2
0
 /// <summary>
 /// 无需 TCP 远程函数申明配置测试
 /// </summary>
 /// <returns></returns>
 //[AutoCSer.Metadata.TestMethod]
 internal static bool TestCase()
 {
     using (AutoCSer.Example.TcpOpenServer.NoAttribute.TcpOpenServer server = new AutoCSer.Example.TcpOpenServer.NoAttribute.TcpOpenServer())
     {
         if (server.IsListen)
         {
             using (AutoCSer.Example.TcpOpenServer.TcpClient.NoAttribute.TcpOpenClient client = new AutoCSer.Example.TcpOpenServer.TcpClient.NoAttribute.TcpOpenClient())
             {
                 AutoCSer.Net.TcpServer.ReturnValue <int> sum = client.Add(2, 3);
                 return(sum.Type == AutoCSer.Net.TcpServer.ReturnType.Success && sum.Value == 2 + 3);
             }
         }
     }
     return(false);
 }