Пример #1
0
        public void MultiLineMapping()
        {
            TypeMapping typeMapping = new TypeMapping("MyTest.NewType");
            typeMapping.Members.Add("method()", "Method1();Method2()");
            CodeBase.Mappings.Add("MyTest.OldType", typeMapping);

            string program = TestUtil.StatementParse("MyTest.OldType ot; ot.method();");
            string expected = TestUtil.CSharpStatementParse("MyTest.OldType ot; ot.Method1(); ot.Method2();");
            CompilationUnit cu = TestUtil.ParseProgram(program);
            VisitCompilationUnit(cu, null);
            TestUtil.CodeEqual(expected, TestUtil.GenerateCode(cu));
        }
Пример #2
0
        public void ConditionalMapping()
        {
            TypeMapping typeMapping = new TypeMapping("MyTest.CSType");
            typeMapping.Members.Add("method()", "Method1();=Method2();Method3()");
            CodeBase.Mappings.Add("MyTest.JavaType", typeMapping);

            string program = TestUtil.StatementParse("MyTest.JavaType jt; int i = jt.method();");
            string expected = TestUtil.CSharpStatementParse("MyTest.JavaType jt; jt.Method1(); int i = jt.Method2();jt.Method3();");
            CompilationUnit cu = TestUtil.ParseProgram(program);
            VisitCompilationUnit(cu, null);
            TestUtil.CodeEqual(expected, TestUtil.GenerateCode(cu));
        }