コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleGenericReturnType()
        public virtual void ShouldHandleGenericReturnType()
        {
            // GIVEN
            TypeReference     owner       = typeReference(typeof(ByteCodeUtilsTest));
            MethodDeclaration declaration = MethodDeclaration.Method(typeParameter("T"), "fail").parameterizedWith("T", extending(typeof(object))).build(owner);

            // WHEN
            string desc      = desc(declaration);
            string signature = signature(declaration);

            // THEN
            assertThat(desc, equalTo("()Ljava/lang/Object;"));
            assertThat(signature, equalTo("<T:Ljava/lang/Object;>()TT;"));
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleGenericThrows()
        public virtual void ShouldHandleGenericThrows()
        {
            // GIVEN
            TypeReference     owner       = typeReference(typeof(ByteCodeUtilsTest));
            MethodDeclaration declaration = MethodDeclaration.Method(typeof(void), "fail", param(TypeReference.ParameterizedType(typeof(CodeGenerationTest.Thrower), typeParameter("E")), "thrower")).parameterizedWith("E", extending(typeof(Exception))).throwsException(typeParameter("E")).build(owner);

            // WHEN
            string signature = signature(declaration);

            string[] exceptions = exceptions(declaration);
            // THEN
            assertThat(signature, equalTo("<E:Ljava/lang/Exception;>(Lorg/neo4j/codegen/CodeGenerationTest$Thrower<TE;>;)V^TE;"));
            assertThat(exceptions, equalTo(new string[] { "java/lang/Exception" }));
        }
コード例 #3
0
ファイル: MethodTemplate.cs プロジェクト: Neo4Net/Neo4Net
 internal override MethodDeclaration.Builder declaration()
 {
     return(MethodDeclaration.Method(_returnType, _name, _parameters));
 }