Beispiel #1
0
        public void AssignExternalObj()
        {
            var a = new ReflectIntoPython(1, "test");

            runBasicTest("b = a\n",
                         new Dictionary <string, object>
            {
                { "a", a }
            },
                         new VariableMultimap(new TupleList <string, object>
            {
                { "b", a }
            }), 1);
        }
Beispiel #2
0
        public void AccessExternalObjProperty()
        {
            // We currently have fields and properties figured out, but we can't assign a method or anything like that. :(
            var a = new ReflectIntoPython(1, "test");

            runBasicTest("b = a.AnInteger\n" +
                         "c = a.AnIntegerProperty\n",
                         new Dictionary <string, object>
            {
                { "a", a }
            },
                         new VariableMultimap(new TupleList <string, object>
            {
                { "b", 1 },
                { "c", 1 }
            }), 1);
        }
        public void FollowTwoLevelsDeep()
        {
            var inner = new ReflectIntoPython(100, "inner");
            var outer = new ReflectIntoPython(0, "outer");

            outer.RecursiveObject = inner;

            runBasicTest(
                "a = obj.AnInteger\n" +
                "b = obj.RecursiveObject.AnInteger\n",
                new Dictionary <string, object>()
            {
                { "obj", outer }
            }, new VariableMultimap(new TupleList <string, object>
            {
                { "a", 0 },
                { "b", 100 }
            }), 1);
        }
 public static bool AGenericExtensionMethodNoArgs <T>(this ReflectIntoPython reflectThis)
 {
     return(true);
 }
 public static T AGenericExtensionMethod <T>(this ReflectIntoPython reflectThis, T arg)
 {
     return(reflectThis.GenericMethod <T>(arg));
 }
 public static int AnExtensionMethodWithArgs(this ReflectIntoPython reflectThis, int number)
 {
     reflectThis.AnInteger += number;
     return(reflectThis.AnInteger);
 }
 public static int AnExtensionMethod(this ReflectIntoPython reflectThis)
 {
     return(reflectThis.AnInteger);
 }