public void EventsHandlerHandleTestRunAttachmentsProcessingCompleteShouldSendAttachmentsProcessingCompleteMessage()
        {
            var attachments = new[] { new AttachmentSet(new System.Uri("http://www.bing.com/"), "code coverage") };
            var args        = new TestRunAttachmentsProcessingCompleteEventArgs(false, null);

            handler.HandleTestRunAttachmentsProcessingComplete(args, attachments);

            mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.Is <TestRunAttachmentsProcessingCompletePayload>(p => p.Attachments == attachments && p.AttachmentsProcessingCompleteEventArgs == args)));
        }
Example #2
0
        public void HandleTestRunAttachmentsProcessingComplete(TestRunAttachmentsProcessingCompleteEventArgs attachmentsProcessingCompleteEventArgs, IEnumerable <AttachmentSet> lastChunk)
        {
            if (lastChunk != null)
            {
                this.Attachments.AddRange(lastChunk);
            }

            if (attachmentsProcessingCompleteEventArgs.Error != null)
            {
                Errors.Add(attachmentsProcessingCompleteEventArgs.Error.Message);
            }

            CompleteArgs = attachmentsProcessingCompleteEventArgs;
        }
        /// <inheritdoc/>
        public void HandleTestRunAttachmentsProcessingComplete(TestRunAttachmentsProcessingCompleteEventArgs attachmentsProcessingCompleteEventArgs, IEnumerable <AttachmentSet> lastChunk)
        {
            if (EqtTrace.IsInfoEnabled)
            {
                EqtTrace.Info("Test run attachments processing completed.");
            }

            var payload = new TestRunAttachmentsProcessingCompletePayload()
            {
                AttachmentsProcessingCompleteEventArgs = attachmentsProcessingCompleteEventArgs,
                Attachments = lastChunk
            };

            this.communicationManager.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, payload);
        }
        private Collection <AttachmentSet> FinalizeOperation(IRequestData requestData, TestRunAttachmentsProcessingCompleteEventArgs completeArgs, Collection <AttachmentSet> attachments, Stopwatch stopwatch, ITestRunAttachmentsProcessingEventsHandler eventHandler)
        {
            testPlatformEventSource.TestRunAttachmentsProcessingStop(attachments.Count);
            requestData.MetricsCollection.Add(TelemetryDataConstants.NumberOfAttachmentsAfterProcessing, attachments.Count);
            requestData.MetricsCollection.Add(TelemetryDataConstants.AttachmentsProcessingState, completeArgs.Error != null ? AttachmentsProcessingFailed : completeArgs.IsCanceled ? AttachmentsProcessingCanceled : AttachmentsProcessingCompleted);

            stopwatch.Stop();
            requestData.MetricsCollection.Add(TelemetryDataConstants.TimeTakenInSecForAttachmentsProcessing, stopwatch.Elapsed.TotalSeconds);

            completeArgs.Metrics = requestData.MetricsCollection.Metrics;
            eventHandler?.HandleTestRunAttachmentsProcessingComplete(completeArgs, attachments);

            return(attachments);
        }