public void CreateNavigationPropertySetter_creates_a_setter_delegate_for_public_reference_property()
            {
                var target = new PublicClass2();
                var entity = new PublicClass1();

                DelegateFactory.CreateNavigationPropertySetter(
                    typeof(PublicClass1), typeof(PublicClass1).GetProperty("PublicNavProperty"))(entity, target);

                Assert.Same(target, entity.PublicNavProperty);
            }
            public void CreateNavigationPropertySetter_creates_a_setter_delegate_for_public_reference_property()
            {
                var target = new PublicClass2();
                var entity = new PublicClass1();

                DelegateFactory.CreateNavigationPropertySetter(
                    typeof(PublicClass1), typeof(PublicClass1).GetDeclaredProperty("PublicNavProperty"))(entity, target);

                Assert.Same(target, entity.PublicNavProperty);
            }
Esempio n. 3
0
        static int Main(string[] args)
        {
            Console.WriteLine("START");

            var t = new PublicClass2();

            t.Test();

            Console.WriteLine("END");
            return(42);
        }
            public void CreatePropertySetter_can_create_a_delegate_for_a_reference_type()
            {
                var target = new PublicClass2();
                var entity = new PublicClass1();

                DelegateFactory.CreatePropertySetter(
                    typeof(PublicClass1),
                    typeof(PublicClass1).GetDeclaredProperty("PublicNavProperty"),
                    allowNull: true)(entity, target);

                Assert.Same(target, entity.PublicNavProperty);
            }
            public void CreatePropertyGetter_creates_getter_delegate_for_public_reference_type_property()
            {
                var target = new PublicClass2();

                Assert.Same(
                    target,
                    DelegateFactory.CreatePropertyGetter(
                        typeof(PublicClass1),
                        typeof(PublicClass1).GetDeclaredProperty("PublicNavProperty"))(
                        new PublicClass1
                {
                    PublicNavProperty = target
                }));
            }
            public void CreatePropertySetter_can_create_a_delegate_for_a_reference_type()
            {
                var target = new PublicClass2();
                var entity = new PublicClass1();

                DelegateFactory.CreatePropertySetter(
                    typeof(PublicClass1),
                    typeof(PublicClass1).GetProperty("PublicNavProperty"),
                    allowNull: true)(entity, target);

                Assert.Same(target, entity.PublicNavProperty);
            }
            public void CreatePropertyGetter_creates_getter_delegate_for_public_reference_type_property()
            {
                var target = new PublicClass2();

                Assert.Same(
                    target,
                    DelegateFactory.CreatePropertyGetter(
                        typeof(PublicClass1),
                        typeof(PublicClass1).GetProperty("PublicNavProperty"))(
                            new PublicClass1
                                {
                                    PublicNavProperty = target
                                }));
            }