public static int MainMethod() { dynamic dy = new MemberClass(); Test t = new Test(); dynamic it = new InnerTest(); decimal dec = 0M; float result = (float)dy.Method_ReturnsFloatConstraint <Test, Test, InnerTest>(t, it, t, ref dec); if (result == 3.4f && dec == 3M) { return(0); } return(1); }