public void Visit_TermAndDoesNotResolver_Throw() { var term = MockRepository.GenerateStub<IDeclarationTerm>(); var node = new TermSyntacticNode(term, Enumerable.Empty<ISyntacticNode>()); var resolverType = MockRepository.GenerateStub<IResolverType>(); var children = Enumerable.Empty<ISyntacticNode>(); var linkedClass = MockRepository.GenerateStub<ILinkedLibrary>(); var resolvers = Enumerable.Empty<IResolver>(); var rewriter = new ResolverSyntaxRewriter(resolverType, resolvers, linkedClass); rewriter.Visit(node, children); }
public void Visit_TermAndSuccessResolve_ResolvingNode() { var term = MockRepository.GenerateStub<IDeclarationTerm>(); var node = new TermSyntacticNode(term, Enumerable.Empty<ISyntacticNode>()); var resolverType = MockRepository.GenerateStub<IResolverType>(); var children = Enumerable.Empty<ISyntacticNode>(); var linkedClass = MockRepository.GenerateStub<ILinkedLibrary>(); var linkedTerm = MockRepository.GenerateStub<IResolvedTerm>(); var resolver = MockRepository.GenerateStub<IResolver>(); resolver.Stub(r => r.Resolve(term, children, linkedClass)).Return(linkedTerm); var resolvers = new[] { resolver }; var rewriter = new ResolverSyntaxRewriter(resolverType, resolvers, linkedClass); var result = rewriter.Visit(node, children); Assert.That(result,Is.Not.Null); Assert.That(result, Is.TypeOf<TermSyntacticNode>()); var termNode = (TermSyntacticNode) result; Assert.That(termNode.Term, Is.SameAs(linkedTerm)); }