void pd_OnTestProgress(TestEventType progressEventType, int progress, int total, string url)
 {
     if (this.OnTestEvent != null)
     {
         OnTestEvent(progressEventType, progress, total, url);
     }
 }
Exemple #2
0
 private void SetTestStatus(TestEventType status, params object[] args)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new setTestStatus(this.SetTestStatus), new object[] { status, args });
         return;
     }
     this.testStatusPanel.SetTestStatus(status, args);
 }
Exemple #3
0
        public static void FireProgressEvent(TestEventType progressEventType, int progress, int total, String url)
        {
            if (IsVerbose)
            {
                if (progressEventType == TestEventType.RequestingFile)
                {
                    Console.WriteLine("Requesting " + url);
                }
                else if (progressEventType == TestEventType.SendingData)
                {
                    Console.WriteLine("Sending Data (" + progress + ") " + url);
                }
                else if (progressEventType == TestEventType.ReceivingData)
                {
                    Console.WriteLine("Receiving Data (" + progress + ") " + url);
                }
                else if (progressEventType == TestEventType.ResponseEnded)
                {
                    Console.WriteLine("Done Receiving " + url);
                }
            }

            if (progressEventType == TestEventType.CapturingSegment)
            {
                Console.WriteLine(String.Concat("Capturing segment ", progress, " out of ", total));
            }
            else if (progressEventType == TestEventType.RenderingSegment)
            {
                Console.WriteLine(String.Concat("Rendering segment ", progress, " out of ", total));
            }
            else if (progressEventType == TestEventType.TestStarted)
            {
                Console.WriteLine("Test Started...");
            }
            else if (progressEventType == TestEventType.TestEnded)
            {
                Console.WriteLine("Test Ended!");
            }
        }
Exemple #4
0
        public void ShouldNotValidateBadSchema()
        {
            var @event = new TestEventType();

            Assert.IsFalse(new EventSchemaValidator().ValidateSchema(@event));
        }
Exemple #5
0
        public void SetTestStatus(TestEventType status, params object[] args)
        {
            if (status == TestEventType.TestEnded)
            {
                this.lblCurrentLabel.Text = "";
                this.lblPreparingTest.SetStatus(TaskProgressLabelStatus.Pending);
                this.lblRenderingSegment.SetStatus(TaskProgressLabelStatus.Pending);
                this.lblCaptureSegment.SetStatus(TaskProgressLabelStatus.Pending);
                this.lblProcessResults.SetStatus(TaskProgressLabelStatus.Pending);
                //this.txtTraceout.Text = "";
                this.lstDownloadedFiles.Reset();

                this.startTestPanel.Visible = true;
                this.workingPanel.Visible   = false;
            }
            else
            {
                this.startTestPanel.Visible = false;
                this.workingPanel.Visible   = true;
            }

            if (status == TestEventType.StartingTest)
            {
                this.lblCurrentLabel.Text = "Starting Test...";
                this.lblPreparingTest.SetStatus(TaskProgressLabelStatus.Pending);
                this.lblRenderingSegment.SetStatus(TaskProgressLabelStatus.Pending);
                this.lblCaptureSegment.SetStatus(TaskProgressLabelStatus.Pending);
                this.lblProcessResults.SetStatus(TaskProgressLabelStatus.Pending);
            }
            else if (status == TestEventType.TestStarted)
            {
                this.lblCurrentLabel.Text = "Loading Page...";
                this.lblPreparingTest.SetStatus(TaskProgressLabelStatus.Completed);
                this.lblRenderingSegment.SetStatus(TaskProgressLabelStatus.Pending);
                this.lblCaptureSegment.SetStatus(TaskProgressLabelStatus.Pending);
                this.lblProcessResults.SetStatus(TaskProgressLabelStatus.Pending);
            }
            else if (status == TestEventType.CapturingSegment || status == TestEventType.RenderingSegment)
            {
                int progress = (int)args[0];
                int total    = (int)args[1];

                if (status == TestEventType.RenderingSegment)
                {
                    this.lblCurrentLabel.Text = "Rendering Segment " + Math.Max(0, Math.Min(progress, total)) + " out of " + total;
                    this.lblPreparingTest.SetStatus(TaskProgressLabelStatus.Completed);
                    this.lblRenderingSegment.SetStatus(TaskProgressLabelStatus.ProgressChange, progress, total);
                    this.lblCaptureSegment.SetStatus(TaskProgressLabelStatus.Pending);
                    this.lblProcessResults.SetStatus(TaskProgressLabelStatus.Pending);
                }
                else if (status == TestEventType.CapturingSegment)
                {
                    this.lblCurrentLabel.Text = "Capturing Segment " + Math.Max(0, Math.Min(progress, total)) + " out of " + total;
                    this.lblPreparingTest.SetStatus(TaskProgressLabelStatus.Completed);
                    this.lblRenderingSegment.SetStatus(TaskProgressLabelStatus.Completed);
                    this.lblCaptureSegment.SetStatus(TaskProgressLabelStatus.ProgressChange, progress, total);
                    this.lblProcessResults.SetStatus(TaskProgressLabelStatus.Pending);
                }
            }
            else if (status == TestEventType.AbortingTest)
            {
                this.lblCurrentLabel.Text = "Aborting Test...";
                this.lblPreparingTest.SetStatus(TaskProgressLabelStatus.Pending);
                this.lblRenderingSegment.SetStatus(TaskProgressLabelStatus.Pending);
                this.lblCaptureSegment.SetStatus(TaskProgressLabelStatus.Pending);
                this.lblProcessResults.SetStatus(TaskProgressLabelStatus.Pending);
            }
            else if (status == TestEventType.ProcessingResults)
            {
                this.lblCurrentLabel.Text = "Processing Results";
                this.lblPreparingTest.SetStatus(TaskProgressLabelStatus.Completed);
                this.lblRenderingSegment.SetStatus(TaskProgressLabelStatus.Completed);
                this.lblCaptureSegment.SetStatus(TaskProgressLabelStatus.Completed);
                this.lblProcessResults.SetStatus(TaskProgressLabelStatus.ProgressChange, -1, -1);
            }
            else if (status == TestEventType.RequestingFile)
            {
                this.lstDownloadedFiles.OnRequestingFile((String)args[2]);
                //this.txtTraceout.AppendText("Downloading " + args[2] + "\r\n");
            }
            else if (status == TestEventType.ResponseEnded)
            {
                this.lstDownloadedFiles.OnFileReceived((String)args[2]);
                //this.txtTraceout.AppendText("Finish Downloading " + args[2] + "\r\n");
            }
            else if (status == TestEventType.SendingData)
            {
                this.lstDownloadedFiles.OnSendingData((String)args[2], (int)args[0]);
                //this.txtTraceout.AppendText("Sending Data " + args[0] + " " + args[2] + "\r\n");
            }
            else if (status == TestEventType.ReceivingData)
            {
                this.lstDownloadedFiles.OnReceivingData((String)args[2], (int)args[0]);
                //this.txtTraceout.AppendText("Receiving Data " + args[0] + " " + args[2] + "\r\n");
            }

            if (status != TestEventType.CapturingSegment &&
                status != TestEventType.RenderingSegment &&
                status != TestEventType.RequestingFile &&
                status != TestEventType.SendingData &&
                status != TestEventType.ReceivingData &&
                status != TestEventType.ResponseEnded)
            {
                Refresh();
            }
        }
Exemple #6
0
 public static void FireProgressEvent(TestEventType progressEventType, String url)
 {
     FireProgressEvent(progressEventType, -1, -1, url);
 }
Exemple #7
0
 public static void FireProgressEvent(TestEventType progressEventType, int progress, int total)
 {
     FireProgressEvent(progressEventType, progress, total, null);
 }
Exemple #8
0
 public static void FireProgressEvent(TestEventType progressEventType)
 {
     FireProgressEvent(progressEventType, -1, -1, null);
 }
Exemple #9
0
 void pageDataCollector_OnTestEvent(TestEventType progressEventType, int progress, int total, string url)
 {
     SetTestStatus(progressEventType, progress, total, url);
 }
Exemple #10
0
        public static IServiceCollection AddEventListener_Mock <TListener>(this IServiceCollection services, SemaphoreSlim sem, TestEventType type)
            where TListener : EventListener_Mock, new ()
        {
            Func <IServiceProvider, TListener> factory = s =>
            {
                var mock = new TListener();
                mock.Semaphore  = sem;
                mock.ListenType = type;
                return(mock);
            };

            services.AddTransient(factory);
            services.AddTransient <IEventListener>(factory);


            return(services);
        }