コード例 #1
0
ファイル: RemoteKey.cs プロジェクト: zhangzheng1205/AutoCSer
        /// <summary>
        /// 实例对象调用链映射测试
        /// </summary>
        /// <returns></returns>
        internal static bool TestCase()
        {
            RemoteKey value = new RemoteKey {
                Id = 1
            };

#if NotSegmentation
            if (value.Remote.NextId != value.NextId)
            {
                return(false);
            }

            if (value.Remote.AddId(2) != value.AddId(2))
            {
                return(false);
            }

            if (value.Remote.RemoteLinkNextId != value.RemoteLink.NextId)
            {
                return(false);
            }

            if (value.Remote.RemoteLink_AddId(3) != value.RemoteLink.AddId(3))
            {
                return(false);
            }
#else
            TcpCall.RemoteKey.RemoteExtension remote = TcpCall.RemoteKey.Remote(value.Id);
            if (remote.NextId != value.NextId)
            {
                return(false);
            }

            if (remote.AddId(2) != value.AddId(2))
            {
                return(false);
            }

            if (remote.RemoteLinkNextId != value.RemoteLink.NextId)
            {
                return(false);
            }

            if (remote.RemoteLink_AddId(3) != value.RemoteLink.AddId(3))
            {
                return(false);
            }
#endif
            return(true);
        }
コード例 #2
0
        //[AutoCSer.Metadata.TestMethod]
        static void Main(string[] args)
        {
#if DotNetStandard
            Console.WriteLine("WARN : Linux .NET Core not support name EventWaitHandle");
#else
            bool            createdProcessWait;
            EventWaitHandle processWait = new EventWaitHandle(false, EventResetMode.ManualReset, "AutoCSer.TestCase.TcpStaticServer", out createdProcessWait);
            if (createdProcessWait)
            {
                using (processWait)
                {
#endif
            using (AutoCSer.Example.TcpStaticServer.TcpStaticServer.Example1 server1 = new AutoCSer.Example.TcpStaticServer.TcpStaticServer.Example1())
                using (AutoCSer.Example.TcpStaticServer.TcpStaticServer.Example2 server2 = new AutoCSer.Example.TcpStaticServer.TcpStaticServer.Example2())
                {
                    Console.WriteLine(@"http://www.AutoCSer.com/TcpServer/MethodServer.html
");
                    if (server1.IsListen && server2.IsListen)
                    {
                        Console.WriteLine(NoAttribute.TestCase());
                        Console.WriteLine(Static.TestCase());
                        Console.WriteLine(Field.TestCase());
                        Console.WriteLine(Property.TestCase());
                        Console.WriteLine(RefOut.TestCase());
                        Console.WriteLine(ClientAsynchronous.TestCase());
                        Console.WriteLine(SendOnly.TestCase());
                        Console.WriteLine(Asynchronous.TestCase());
                        Console.WriteLine(KeepCallback.TestCase());
                        Console.WriteLine(RemoteKey.TestCase());
                        Console.WriteLine(RemoteLinkType.TestCase());
                        Console.WriteLine(Expression.TestCase());
                        Console.WriteLine("Over");
                    }
                    else
                    {
                        Console.WriteLine("示例服务启动失败");
                    }
                    Console.ReadKey();
                }
#if !DotNetStandard
        }
    }
#endif
        }