Example #1
0
        /// <summary>
        /// Creates a new AppDomain, pings the remote side, and bails.
        /// </summary>
        /// <param name="pluginPath">Absolute path to plugin directory.</param>
        public static void RunTest(string pluginPath)
        {
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("----- PingTest -----");
            Console.ResetColor();

            using (DomainManager plugDom = new DomainManager(pluginPath)) {
                plugDom.CreateDomain("Plugin AppDomain",
                                     DomainManager.DomainCapabilities.STATIC_ONLY);

                Console.WriteLine("Ping from host (id=" +
                                  AppDomain.CurrentDomain.Id + ")");

                Console.WriteLine("ping 1 returned " +
                                  plugDom.Ping(1));

                // If testing Sponsor with short leases, it's useful to
                // re-try the ping after the lease renewal has had a
                // chance to fire.
                //Thread.Sleep(12 * 1000 + 1000);
                Console.WriteLine("ping 2 returned " +
                                  plugDom.Ping(2));
            }
        }