Beispiel #1
0
        internal static TestPathTreeNode DeserializePath(TestSuite suite, TestContext ctx, XElement root)
        {
            var resolver = (IPathResolver)suite;

            var path = TestPath.Read(root);

            foreach (var node in path.Nodes)
            {
                if (node.PathType == TestPathType.Group)
                {
                    continue;
                }
                resolver = resolver.Resolve(ctx, node);
            }

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

            var status = (TestStatus)Enum.Parse(typeof(TestStatus), node.Attribute("Status").Value);

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

            var result = new TestResult(path, status);

            var elapsedTime = node.Element("ElapsedTime");

            if (elapsedTime != null)
            {
                result.ElapsedTime = TimeSpan.FromMilliseconds(int.Parse(elapsedTime.Value));
            }

            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);
        }