public void CallOverloadedPrivateInstanceMethod_of_DerivedClass_by_Dynamic()
        {
            object obj = new DerivedTestTargetClass();

            var actual1 = (string)obj.ToDynamic().MethodC("King");
            actual1.Is("Method-C by string: King");

            var actual2 = (int)obj.ToDynamic().MethodC(29);
            actual2.Is(29);
        }
Esempio n. 2
0
        public void CallOverloadedPrivateInstanceMethod_of_DerivedClass_by_LateBinder()
        {
            object obj = new DerivedTestTargetClass();

            obj.ToLateBind().Call("MethodC", "Adelie")
                .IsInstanceOf<string>()
                .Is("Method-C by string: Adelie");

            obj.ToLateBind().Call("MethodC", 27)
                .IsInstanceOf<int>()
                .Is(27);
        }
        public void GetAndSetPrivateInstanceField_of_DerivedClass_by_Dynamic()
        {
            object obj = new DerivedTestTargetClass();
            var actual1 = (DateTime)obj.ToDynamic()._FieldB;
            actual1.Is(DateTime.Parse("2014/02/13 14:27:56"));

            obj.ToDynamic()._FieldB = DateTime.Parse("2016/12/10 03:07:04");

            var actual2 = (DateTime)obj.ToDynamic()._FieldB;
            actual2.Is(DateTime.Parse("2016/12/10 03:07:04"));
        }
        public void GetAndSetPrivateStaticField_of_DerivedClass_by_Dynamic()
        {
            var obj = new DerivedTestTargetClass();
            var binder = DynamicBinder.Create(obj.GetType());
            var actual1 = (string)binder._FieldE;
            actual1.Is("Static Foo");

            try
            {
                binder._FieldE = "Static Dynamic Bar";

                var actual2 = (string)binder._FieldE;
                actual2.Is("Static Dynamic Bar");
            }
            finally
            {
                binder._FieldE = "Static Foo";
            }
        }
        public void GetAndSetPrivateInstanceProperty_of_DerivedClass_by_Dynamic()
        {
            object obj = new DerivedTestTargetClass();
            var actual1 = (string)obj.ToDynamic().PropA;
            actual1.Is("Fizz");

            obj.ToDynamic().PropA = "Dynamic Buzz";

            var actual2 = (string)obj.ToDynamic().PropA;
            actual2.Is("Dynamic Buzz");
        }
Esempio n. 6
0
        public void GetAndSetPrivateStaticField_of_DerivedClass_by_LateBinder()
        {
            object obj = new DerivedTestTargetClass();
            var binder = LateBinder.Create(obj.GetType());

            binder.Field["_FieldE"]
                .IsInstanceOf<string>()
                .Is("Static Foo");

            try
            {
                binder.Field["_FieldE"] = "Static Bar";

                binder.Field["_FieldE"]
                    .Is("Static Bar");
            }
            finally
            {
                binder.Field["_FieldE"] = "Static Foo";
            }
        }
Esempio n. 7
0
        public void GetAndSetPrivateInstanceProperty_of_DerivedClass_by_LateBinder()
        {
            object obj = new DerivedTestTargetClass();
            obj.ToLateBind().Prop["PropA"]
                .IsInstanceOf<string>()
                .Is("Fizz");

            obj.ToLateBind().Prop["PropA"] = "Buzz";

            obj.ToLateBind().Prop["PropA"]
                .Is("Buzz");
        }
Esempio n. 8
0
        public void GetAndSetPrivateInstanceField_of_DerivedClass_by_LateBinder()
        {
            object obj = new DerivedTestTargetClass();
            obj.ToLateBind().Field["_FieldB"]
                .IsInstanceOf<DateTime>()
                .Is(DateTime.Parse("2014/02/13 14:27:56"));

            obj.ToLateBind().Field["_FieldB"] = DateTime.Parse("2015/11/09 02:06:03");

            obj.ToLateBind().Field["_FieldB"]
                .Is(DateTime.Parse("2015/11/09 02:06:03"));
        }