Esempio n. 1
0
        /// <summary>
        /// 无需 TCP 远程函数申明配置测试
        /// </summary>
        /// <returns></returns>
        //[AutoCSer.Metadata.TestMethod]
        internal static bool TestCase()
        {
            using (AutoCSer.Example.TcpInternalServer.NoAttribute.TcpInternalServer server = new AutoCSer.Example.TcpInternalServer.NoAttribute.TcpInternalServer())
            {
                if (server.IsListen)
                {
                    using (AutoCSer.Example.TcpInternalServer.NoAttribute.TcpInternalClient client = new AutoCSer.Example.TcpInternalServer.NoAttribute.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);
        }
Esempio n. 2
0
 /// <summary>
 /// 无需 TCP 远程函数申明配置测试
 /// </summary>
 /// <returns></returns>
 //[AutoCSer.Metadata.TestMethod]
 internal static bool TestCase()
 {
     using (AutoCSer.Example.TcpInternalServer.NoAttribute.TcpInternalServer server = new AutoCSer.Example.TcpInternalServer.NoAttribute.TcpInternalServer())
     {
         if (server.IsListen)
         {
             using (AutoCSer.Example.TcpInternalServer.NoAttribute.TcpInternalClient client = new AutoCSer.Example.TcpInternalServer.NoAttribute.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);
 }