public void InheritedTypesFromTypeHasAccessor()
        {
            string program = TestUtil.GetInput();
            CompilationUnit cu = TestUtil.ParseProgram(program);
            TypesVisitor typesVisitor = new TypesVisitor();
            typesVisitor.CodeBase = CodeBase;
            typesVisitor.VisitCompilationUnit(cu, null);
            InheritorsVisitor inheritorsVisitor = new InheritorsVisitor();
            inheritorsVisitor.CodeBase = CodeBase;
            inheritorsVisitor.VisitCompilationUnit(cu, null);

            VisitCompilationUnit(cu, null);

            Assert.AreEqual(4, CodeBase.References.Count);
            Assert.IsTrue(CodeBase.References.Contains("Test.IGraph.getDegree"));
            Assert.IsTrue(CodeBase.References.Contains("Test.ITree.getDegree"));
            Assert.IsTrue(CodeBase.References.Contains("Test.GenericTree.getDegree"));
            Assert.IsTrue(CodeBase.References.Contains("Test.BinaryTree.getDegree"));
        }
        public void InterfaceSetterGetter()
        {
            string program = TestUtil.GetInput();
            string expected = TestUtil.GetExpected();

            CompilationUnit cu = TestUtil.ParseProgram(program);
            NamespaceDeclaration ns = (NamespaceDeclaration) cu.Children[0];
            TypeDeclaration ty1 = (TypeDeclaration) ns.Children[0];
            TypeDeclaration ty2 = (TypeDeclaration) ns.Children[1];
            TypeDeclaration ty3 = (TypeDeclaration) ns.Children[2];

            CodeBase.Types.Add("Test.IShape", ty1);
            CodeBase.Types.Add("Test.Shape", ty2);
            CodeBase.Types.Add("Test.Rectangle", ty3);

            InheritorsVisitor inheritorsVisitor = new InheritorsVisitor();
            inheritorsVisitor.CodeBase = CodeBase;
            inheritorsVisitor.VisitCompilationUnit(cu, null);
            VisitCompilationUnit(cu, null);

            TestUtil.CodeEqual(expected, TestUtil.GenerateCode(cu));
            Assert.AreEqual(6, CodeBase.References.Count);
        }
        public void Siblings()
        {
            string program = TestUtil.GetInput();
            string expected = TestUtil.GetExpected();

            CompilationUnit cu = TestUtil.ParseProgram(program);

            TypesVisitor typesVisitor = new TypesVisitor();
            typesVisitor.CodeBase = CodeBase;
            typesVisitor.VisitCompilationUnit(cu, null);

            InheritorsVisitor inheritorsVisitor = new InheritorsVisitor();
            inheritorsVisitor.CodeBase = CodeBase;
            inheritorsVisitor.VisitCompilationUnit(cu, null);

            VisitCompilationUnit(cu, null);

            TestUtil.CodeEqual(expected, TestUtil.GenerateCode(cu));
        }