コード例 #1
0
        public void GetNameDeclarationsNoDeclarations()
        {
            var node = new IdentifierExpression();

            child.AddDeclaration("blah", node);

            var declarations = child.GetNameDeclarations("notBlah");

            Assert.NotNull(declarations, "declarations");
            Assert.AreEqual(0, declarations.Count(), "Wrong declaration count");
        }
コード例 #2
0
        public void GetNameDeclarationsInChildSpace()
        {
            var child2 = new LocalDeclarationSpace();

            parent.AddChildSpace(child);
            parent.AddChildSpace(child2);

            var node1 = new IdentifierExpression();

            child.AddDeclaration("blah", node1);

            var node2 = new IdentifierExpression();

            child.AddDeclaration("blah", node2);

            var declarations = parent.GetNameDeclarations("blah").ToList();

            Assert.NotNull(declarations, "declarations");
            Assert.AreEqual(2, declarations.Count, "Wrong declaration count");
            Assert.That(declarations.Contains(node1), "node1 was not one of the declarations");
            Assert.That(declarations.Contains(node2), "node2 was not one of the declarations");
        }