Beispiel #1
0
        public static TestResult ReadTestResult(XElement node)
        {
            if (!node.Name.LocalName.Equals("TestResult"))
            {
                throw new InternalErrorException();
            }

            var name   = TestSerializer.ReadTestName(node.Element("TestName"));
            var status = (TestStatus)Enum.Parse(typeof(TestStatus), node.Attribute("Status").Value);

            var result = new TestResult(name, status);

            var path = node.Element("TestPath");

            if (path != null)
            {
                result.Path = new PathWrapper(path);
            }

            foreach (var error in node.Elements("Error"))
            {
                result.AddError(ReadError(error));
            }

            foreach (var message in node.Elements("Message"))
            {
                result.AddMessage(message.Attribute("Text").Value);
            }

            foreach (var log in node.Elements("LogEntry"))
            {
                result.AddLogMessage(ReadLogEntry(log));
            }

            foreach (var child in node.Elements("TestResult"))
            {
                result.AddChild(ReadTestResult(child));
            }

            return(result);
        }
Beispiel #2
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.Element("TestName");

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

            return(instance);
        }