Esempio n. 1
0
        /// <summary>
        /// ref / out 参数 测试
        /// </summary>
        /// <returns></returns>
        //[AutoCSer.Metadata.TestMethod]
        internal static bool TestCase()
        {
            using (AutoCSer.Example.TcpInternalStreamServer.RefOut.TcpInternalStreamServer server = new AutoCSer.Example.TcpInternalStreamServer.RefOut.TcpInternalStreamServer())
            {
                if (server.IsListen)
                {
                    using (AutoCSer.Example.TcpInternalStreamServer.RefOut.TcpInternalStreamClient client = new AutoCSer.Example.TcpInternalStreamServer.RefOut.TcpInternalStreamClient())
                    {
                        int right = 3, product;
                        AutoCSer.Net.TcpServer.ReturnValue <int> sum = client.Add(2, ref right, out product);
                        if (sum.Type != AutoCSer.Net.TcpServer.ReturnType.Success || sum.Value != 2 + 3 || right != (3 << 1) || product != 2 * 3)
                        {
                            return(false);
                        }

                        return(true);
                    }
                }
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// 远程表达式测试
        /// </summary>
        /// <returns></returns>
        internal static bool TestCase()
        {
            using (AutoCSer.Example.TcpInternalStreamServer.RefOut.TcpInternalStreamServer server = new AutoCSer.Example.TcpInternalStreamServer.RefOut.TcpInternalStreamServer())
            {
                if (server.IsListen)
                {
                    using (AutoCSer.Example.TcpInternalStreamServer.RefOut.TcpInternalStreamClient client = new AutoCSer.Example.TcpInternalStreamServer.RefOut.TcpInternalStreamClient())
                    {
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField).Value.Value != 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty).Value.Value != 2)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3)).Value.Value != 3)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.Value).Value != 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.Value).Value != 2)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).Value).Value != 3)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(4)[3]).Value != 4 + 3)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(4).GetNextNode(2)).Value.Value != 4 + 2)
                        {
                            return(false);
                        }

                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.NextNode).Value.Value != 1 + 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.NextNode).Value.Value != 2 + 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).NextNode).Value.Value != 3 + 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.NextNode.Value).Value != 1 + 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.NextNode.Value).Value != 2 + 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).NextNode.Value).Value != 3 + 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(4).NextNode[3]).Value != 4 + 1 - 3)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(4).NextNode.GetLastNode(2)).Value.Value != 4 + 1 - 2)
                        {
                            return(false);
                        }

                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.NextNode.LastNode).Value.Value != 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.NextNode.LastNode).Value.Value != 2)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).NextNode.LastNode).Value.Value != 3)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.NextNode.LastNode.Value).Value != 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.NextNode.LastNode.Value).Value != 2)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).NextNode.LastNode.Value).Value != 3)
                        {
                            return(false);
                        }

                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.NextNode.LastNode.NextNode).Value.Value != 1 + 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.NextNode.LastNode.NextNode).Value.Value != 2 + 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).NextNode.LastNode.NextNode).Value.Value != 3 + 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.NextNode.LastNode.NextNode.Value).Value != 1 + 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.NextNode.LastNode.NextNode.Value).Value != 2 + 1)
                        {
                            return(false);
                        }
                        if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).NextNode.LastNode.NextNode.Value).Value != 3 + 1)
                        {
                            return(false);
                        }

                        return(true);
                    }
                }
            }
            return(false);
        }