Example #1
0
        public void Run()
        {
            using (var httpServer = new MicroHttpServer())
            {
                switch (SilverlightVersion)
                {
                    case "SL2":
                        httpServer.AddResourceHandler("/Silverlight.js", "text/plain", typeof(ConsoleRunner), "Silverlight2.js");
                        httpServer.AddResourceHandler("/XapHost.html", "text/html", typeof(ConsoleRunner), "XapHost2.html");
                        break;

                    case "SL3":
                        httpServer.AddResourceHandler("/Silverlight.js", "text/plain", typeof(ConsoleRunner), "Silverlight3.js");
                        httpServer.AddResourceHandler("/XapHost.html", "text/html", typeof(ConsoleRunner), "XapHost3.html");
                        break;

                    case "SL4":
                        httpServer.AddResourceHandler("/Silverlight.js", "text/plain", typeof(ConsoleRunner), "Silverlight4.js");
                        httpServer.AddResourceHandler("/XapHost.html", "text/html", typeof(ConsoleRunner), "XapHost4.html");
                        break;

                    default:
                        throw new NotSupportedException("Unsupported silverlight version: '" + SilverlightVersion + "'"); 
                }

                httpServer.AddFileHandler("/xapfile.xap", "application/x-silverlight-app", this.XapFile);
                httpServer.Start();

                using (var form = new RunnerForm())
                {
                    form.OnLogEvent += this.OnLogEvent;
                    form.OnCompleted += this.OnCompleted;
                    form.Url = "http://localhost:" + httpServer.ListenPort + "/XapHost.html";
                    form.ShowDialog();
                }

                this.Log(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        "Passed: {0} Failed: {1} Pass Rate: {2}%",
                        this.PassedCount,
                        this.FailedCount,
                        Math.Round(100.0 * this.PassedCount / (this.PassedCount + this.FailedCount + this.OtherCount), 2)));
            }
        }
Example #2
0
        public void Run()
        {
            using (var httpServer = new MicroHttpServer())
            {
                switch (SilverlightVersion)
                {
                case "SL2":
                    httpServer.AddResourceHandler("/Silverlight.js", "text/plain", typeof(ConsoleRunner), "Silverlight2.js");
                    httpServer.AddResourceHandler("/XapHost.html", "text/html", typeof(ConsoleRunner), "XapHost2.html");
                    break;

                case "SL3":
                    httpServer.AddResourceHandler("/Silverlight.js", "text/plain", typeof(ConsoleRunner), "Silverlight3.js");
                    httpServer.AddResourceHandler("/XapHost.html", "text/html", typeof(ConsoleRunner), "XapHost3.html");
                    break;

                case "SL4":
                    httpServer.AddResourceHandler("/Silverlight.js", "text/plain", typeof(ConsoleRunner), "Silverlight4.js");
                    httpServer.AddResourceHandler("/XapHost.html", "text/html", typeof(ConsoleRunner), "XapHost4.html");
                    break;

                default:
                    throw new NotSupportedException("Unsupported silverlight version: '" + SilverlightVersion + "'");
                }

                httpServer.AddFileHandler("/xapfile.xap", "application/x-silverlight-app", this.XapFile);
                httpServer.Start();

                using (var form = new RunnerForm())
                {
                    form.OnLogEvent  += this.OnLogEvent;
                    form.OnCompleted += this.OnCompleted;
                    form.Url          = "http://localhost:" + httpServer.ListenPort + "/XapHost.html";
                    form.ShowDialog();
                }

                this.Log(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        "Passed: {0} Failed: {1} Pass Rate: {2}%",
                        this.PassedCount,
                        this.FailedCount,
                        Math.Round(100.0 * this.PassedCount / (this.PassedCount + this.FailedCount + this.OtherCount), 2)));
            }
        }
Example #3
0
        public void Run()
        {
            using (var httpServer = new MicroHttpServer())
            {
                httpServer.AddHandler("/Completed", OnTestCompleted);
                httpServer.AddHandler("/TestMethodCompleted", OnTestMethodCompleted);
                
                switch (SilverlightVersion)
                {
                    case "SL2":
                        httpServer.AddResourceHandler("/Silverlight.js", "text/plain", typeof(ConsoleRunner), "Silverlight2.js");
                        httpServer.AddResourceHandler("/XapHost.html", "text/html", typeof(ConsoleRunner), "XapHost2.html");
                        break;

                    case "SL3":
                        httpServer.AddResourceHandler("/Silverlight.js", "text/plain", typeof(ConsoleRunner), "Silverlight3.js");
                        httpServer.AddResourceHandler("/XapHost.html", "text/html", typeof(ConsoleRunner), "XapHost3.html");
                        break;

                    case "SL4":
                        httpServer.AddResourceHandler("/Silverlight.js", "text/plain", typeof(ConsoleRunner), "Silverlight4.js");
                        httpServer.AddResourceHandler("/XapHost.html", "text/html", typeof(ConsoleRunner), "XapHost4.html");
                        break;

                    case "WP7":
                    case "WP71":
                        break;

                    default:
                        throw new NotSupportedException("Unsupported silverlight version: '" + SilverlightVersion + "'"); 
                }

                httpServer.AddFileHandler("/xapfile.xap", "application/x-silverlight-app", this.XapFile);
                httpServer.Start();

                if (this.SilverlightVersion.StartsWith("SL"))
                {
                    using (var form = new RunnerForm())
                    {
                        form.Url = "http://localhost:" + httpServer.ListenPort + "/XapHost.html";
                        this.currentForm = form;
                        this.ResetTimer();
                        form.ShowDialog();
                        this.currentForm = null;
                    }
                }
                else if (this.SilverlightVersion.StartsWith("WP"))
                {
                    XapRunner.RunXap(this.XapFile, this.IconFile, this.AppGuid, this.DevicePlatformName, this.DeviceName);
                    this.ResetTimer();
                }
                else
                {
                    throw new NotImplementedException();
                }

                this.finished.WaitOne();

                this.Log(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        "Passed: {0} Failed: {1} Pass Rate: {2}%",
                        this.PassedCount,
                        this.FailedCount,
                        Math.Round(100.0 * this.PassedCount / (this.PassedCount + this.FailedCount + this.OtherCount), 2)));
            }
        }
Example #4
0
        public void Run()
        {
            using (var httpServer = new MicroHttpServer())
            {
                httpServer.AddHandler("/Completed", OnTestCompleted);
                httpServer.AddHandler("/TestMethodCompleted", OnTestMethodCompleted);

                switch (SilverlightVersion)
                {
                case "SL2":
                    httpServer.AddResourceHandler("/Silverlight.js", "text/plain", typeof(ConsoleRunner), "Silverlight2.js");
                    httpServer.AddResourceHandler("/XapHost.html", "text/html", typeof(ConsoleRunner), "XapHost2.html");
                    break;

                case "SL3":
                    httpServer.AddResourceHandler("/Silverlight.js", "text/plain", typeof(ConsoleRunner), "Silverlight3.js");
                    httpServer.AddResourceHandler("/XapHost.html", "text/html", typeof(ConsoleRunner), "XapHost3.html");
                    break;

                case "SL4":
                    httpServer.AddResourceHandler("/Silverlight.js", "text/plain", typeof(ConsoleRunner), "Silverlight4.js");
                    httpServer.AddResourceHandler("/XapHost.html", "text/html", typeof(ConsoleRunner), "XapHost4.html");
                    break;

                case "WP7":
                case "WP71":
                    break;

                default:
                    throw new NotSupportedException("Unsupported silverlight version: '" + SilverlightVersion + "'");
                }

                httpServer.AddFileHandler("/xapfile.xap", "application/x-silverlight-app", this.XapFile);
                httpServer.Start();

                if (this.SilverlightVersion.StartsWith("SL"))
                {
                    using (var form = new RunnerForm())
                    {
                        form.Url         = "http://localhost:" + httpServer.ListenPort + "/XapHost.html";
                        this.currentForm = form;
                        this.ResetTimer();
                        form.ShowDialog();
                        this.currentForm = null;
                    }
                }
                else if (this.SilverlightVersion.StartsWith("WP"))
                {
                    XapRunner.RunXap(this.XapFile, this.IconFile, this.AppGuid, this.DevicePlatformName, this.DeviceName);
                    this.ResetTimer();
                }
                else
                {
                    throw new NotImplementedException();
                }

                this.finished.WaitOne();

                this.Log(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        "Passed: {0} Failed: {1} Pass Rate: {2}%",
                        this.PassedCount,
                        this.FailedCount,
                        Math.Round(100.0 * this.PassedCount / (this.PassedCount + this.FailedCount + this.OtherCount), 2)));
            }
        }