Example #1
0
        void OnStatisticsEvent(TestLoggerBackend.StatisticsEventArgs args)
        {
            switch (args.Type)
            {
            case TestLoggerBackend.StatisticsEventType.Running:
                ++countTests;
                Debug("Running {0}", args.Name);
                break;

            case TestLoggerBackend.StatisticsEventType.Finished:
                switch (args.Status)
                {
                case TestStatus.Success:
                    ++countSuccess;
                    break;

                case TestStatus.Ignored:
                case TestStatus.None:
                    ++countIgnored;
                    break;

                default:
                    ++countErrors;
                    break;
                }

                Debug("Finished {0}: {1}", args.Name, args.Status);
                break;

            case TestLoggerBackend.StatisticsEventType.Reset:
                break;
            }
        }
Example #2
0
        public static XElement WriteStatisticsEvent(TestLoggerBackend.StatisticsEventArgs instance)
        {
            if (instance.IsRemote)
            {
                throw new InternalErrorException();
            }

            var element = new XElement("TestStatisticsEventArgs");

            element.SetAttributeValue("Type", instance.Type.ToString());
            element.SetAttributeValue("Status", instance.Status.ToString());

            if (instance.Name != null)
            {
                element.SetAttributeValue("Name", instance.Name);
            }

            return(element);
        }
Example #3
0
        internal void OnStatisticsEvent(TestLoggerBackend.StatisticsEventArgs args)
        {
            switch (args.Type)
            {
            case TestLoggerBackend.StatisticsEventType.Running:
                ++countTests;
                CurrentTestName.Value = string.Format("Running {0}", args.Name);
                break;

            case TestLoggerBackend.StatisticsEventType.Finished:
                switch (args.Status)
                {
                case TestStatus.Success:
                    ++countSuccess;
                    break;

                case TestStatus.Ignored:
                case TestStatus.None:
                    ++countIgnored;
                    break;

                default:
                    ++countErrors;
                    break;
                }

                CurrentTestName.Value = string.Format("Finished {0}: {1}", args.Name, args.Status);
                break;

            case TestLoggerBackend.StatisticsEventType.Reset:
                countTests            = countSuccess = countErrors = countIgnored = 0;
                CurrentTestName.Value = string.Empty;
                break;

            default:
                break;
            }

            StatusMessage.Value = GetStatusMessage(CurrentTestName.Value);
        }
Example #4
0
        void OnStatisticsEvent(TestLoggerBackend.StatisticsEventArgs args)
        {
            switch (args.Type)
            {
            case TestLoggerBackend.StatisticsEventType.Running:
                ++countTests;
                Debug("Running {0}", args.Name);
                Controller.StatusMessage("Running {0}", args.Name);
                break;

            case TestLoggerBackend.StatisticsEventType.Finished:
                switch (args.Status)
                {
                case TestStatus.Success:
                    ++countSuccess;
                    break;

                case TestStatus.Ignored:
                case TestStatus.None:
                    ++countIgnored;
                    break;

                default:
                    ++countErrors;
                    break;
                }

                Debug("Finished {0}: {1}", args.Name, args.Status);

                Controller.StatusMessage("Finished {0}: {1}", args.Name, args.Status);
                Controller.StatisticsMessage("{0} test run, {1} ignored, {2} passed, {3} errors.",
                                             countTests, countIgnored, countSuccess, countErrors);
                break;

            case TestLoggerBackend.StatisticsEventType.Reset:
                OnResetStatistics();
                break;
            }
        }
Example #5
0
        public static TestLoggerBackend.StatisticsEventArgs ReadStatisticsEvent(XElement node)
        {
            if (!node.Name.LocalName.Equals("TestStatisticsEventArgs"))
            {
                throw new InternalErrorException();
            }

            var instance = new TestLoggerBackend.StatisticsEventArgs();

            instance.Type     = (TestLoggerBackend.StatisticsEventType)Enum.Parse(typeof(TestLoggerBackend.StatisticsEventType), node.Attribute("Type").Value);
            instance.Status   = (TestStatus)Enum.Parse(typeof(TestStatus), node.Attribute("Status").Value);
            instance.IsRemote = true;

            var name = node.Attribute("Name");

            if (name != null)
            {
                instance.Name = name.Value;
            }

            return(instance);
        }
Example #6
0
 public void StatisticsEvent(TestLoggerBackend.StatisticsEventArgs args)
 {
     Logger.OnStatisticsEvent(args);
 }
Example #7
0
 public async Task StatisticsEvent(TestLoggerBackend.StatisticsEventArgs args, CancellationToken cancellationToken)
 {
     LocalLogger.OnStatisticsEvent(args);
     var command = new StatisticsCommand();
     await command.Send(this, args, cancellationToken);
 }