public void CreateNavigationPropertySetter_creates_a_setter_delegate_for_public_reference_property_and_accepts_derived_types() { var target = new PublicClass2d(); var entity = new PublicClass1(); DelegateFactory.CreateNavigationPropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetDeclaredProperty("PublicNavProperty"))(entity, target); Assert.Same(target, entity.PublicNavProperty); }
public void CreateNavigationPropertySetter_creates_a_setter_delegate_for_public_reference_property_and_accepts_derived_types() { var target = new PublicClass2d(); var entity = new PublicClass1(); DelegateFactory.CreateNavigationPropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetProperty("PublicNavProperty"))(entity, target); Assert.Same(target, entity.PublicNavProperty); }
public void CreatePropertySetter_can_create_a_delegate_for_a_nullable_type_that_allows_null_to_be_set() { var entity = new PublicClass1(); DelegateFactory.CreatePropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetDeclaredProperty("NullableProperty"), allowNull: true)(entity, null); Assert.Null(entity.NullableProperty); }
public void CreatePropertySetter_can_create_a_delegate_for_a_nullable_type() { var entity = new PublicClass1(); DelegateFactory.CreatePropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetDeclaredProperty("NullableProperty"), allowNull: true)(entity, 7); Assert.Equal(7, entity.NullableProperty); }
public void CreatePropertySetter_can_create_a_delegate_for_a_value_type() { var entity = new PublicClass1(); DelegateFactory.CreatePropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetDeclaredProperty("InternalValueTypeProperty"), allowNull: false)(entity, 7); Assert.Equal(7, entity.InternalValueTypeProperty); }
public void CreateNavigationPropertySetter_creates_a_setter_delegate_for_non_public_reference_property() { var target = new InternalClass(); var entity = new PublicClass1(); DelegateFactory.CreateNavigationPropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetDeclaredProperty("InternalNavProperty"))(entity, target); Assert.Same(target, entity.InternalNavProperty); }
public void CreateNavigationPropertySetter_creates_a_setter_delegate_for_non_public_reference_property() { var target = new InternalClass(); var entity = new PublicClass1(); DelegateFactory.CreateNavigationPropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetProperty("InternalNavProperty", BindingFlags.Instance | BindingFlags.NonPublic))(entity, target); Assert.Same(target, entity.InternalNavProperty); }
public void CreatePropertySetter_can_create_a_delegate_for_a_nullable_type() { var entity = new PublicClass1(); DelegateFactory.CreatePropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetProperty("NullableProperty", BindingFlags.NonPublic | BindingFlags.Instance), allowNull: true)(entity, 7); Assert.Equal(7, entity.NullableProperty); }
public void CreatePropertySetter_can_create_a_delegate_for_a_reference_type_that_allows_a_derived_type_to_be_set() { var target = new PublicClass2d(); var entity = new PublicClass1(); DelegateFactory.CreatePropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetDeclaredProperty("PublicNavProperty"), allowNull: true)(entity, target); Assert.Same(target, entity.PublicNavProperty); }
public void CreatePropertySetter_creates_a_setter_delegate_for_a_non_public_property() { var target = new InternalClass(); var entity = new PublicClass1(); DelegateFactory.CreatePropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetProperty("InternalNavProperty", BindingFlags.Instance | BindingFlags.NonPublic), allowNull: true)(entity, target); Assert.Same(target, entity.InternalNavProperty); }
public void CreatePropertySetter_can_create_a_delegate_for_a_nullable_type_that_allows_null_to_be_set() { var entity = new PublicClass1(); DelegateFactory.CreatePropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetProperty("NullableProperty", BindingFlags.NonPublic | BindingFlags.Instance), allowNull: true)(entity, null); Assert.Null(entity.NullableProperty); }
public void CreatePropertySetter_can_create_a_delegate_for_a_value_type() { var entity = new PublicClass1(); DelegateFactory.CreatePropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetProperty("InternalValueTypeProperty", BindingFlags.NonPublic | BindingFlags.Instance), allowNull: false)(entity, 7); Assert.Equal(7, entity.InternalValueTypeProperty); }
public void CreatePropertySetter_can_create_a_delegate_for_a_reference_type_that_allows_null_to_be_set() { var entity = new PublicClass1(); DelegateFactory.CreatePropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetProperty("PublicNavProperty"), allowNull: true)(entity, null); Assert.Null(entity.PublicNavProperty); }
public void CreatePropertySetter_can_create_a_delegate_for_a_reference_type_that_allows_a_derived_type_to_be_set() { var target = new PublicClass2d(); var entity = new PublicClass1(); DelegateFactory.CreatePropertySetter( typeof(PublicClass1), typeof(PublicClass1).GetProperty("PublicNavProperty"), allowNull: true)(entity, target); Assert.Same(target, entity.PublicNavProperty); }