示例#1
0
        public void Resolve()
        {
            if (resolved)
            {
                return;
            }

            if (Tree.Inner != null)
            {
                var node      = new TestNodeInternal(Tree.Inner.Host);
                var innerPath = new TestPath(Path, node);
                innerNode = new TestPathTreeNode(Tree.Inner, innerPath, node);
                return;
            }

            children = new List <TestPathTreeNode> ();
            foreach (var child in Tree.Builder.Children)
            {
                var node      = new TestNodeInternal(child.Host, child.Parameter);
                var childPath = new TestPath(Path, node);
                children.Add(new TestPathTreeNode(child.TreeRoot, childPath, node));
            }

            resolved = true;
        }
示例#2
0
        public TestPath GetCurrentPath()
        {
            if (currentPath != null)
            {
                return(currentPath);
            }

            var node = new TestNodeInternal(Instance.Host, Parameter);

            currentPath = new TestPath(Instance.ParentPath, node);
            return(currentPath);
        }
示例#3
0
        public IPathResolver Resolve(TestContext ctx, TestNode node)
        {
            Resolve(ctx);

            if (innerNode != null)
            {
                innerNode.Resolve(ctx);

                if (!TestNodeInternal.Matches(innerNode.Tree.Host, node))
                {
                    throw new InternalErrorException();
                }
                if (node.ParameterValue != null)
                {
                    return(innerNode.Parameterize(node.ParameterValue));
                }
                return(innerNode);
            }

            if (node.ParameterValue == null)
            {
                throw new InternalErrorException();
            }

            foreach (var child in children)
            {
                if (!TestNodeInternal.Matches(child.Node, node))
                {
                    throw new InternalErrorException();
                }

                if (!node.ParameterValue.Equals(child.Node.Parameter.Value))
                {
                    continue;
                }

                return(child);
            }

            throw new InternalErrorException();
        }
示例#4
0
 public TestPathTreeNode(TestPathTree tree, TestPath path)
 {
     Tree = tree;
     Path = path;
     Node = (TestNodeInternal)path.Node;
 }
示例#5
0
 public TestPathTreeNode(TestPathTree tree, TestPath path, TestNodeInternal node)
 {
     Tree = tree;
     Path = path;
     Node = node;
 }
示例#6
0
        public static bool Matches(TestHost host, TestNode second)
        {
            var hostNode = new TestNodeInternal(host);

            return(Matches(hostNode, second));
        }