public void GetPropertyAccessExpression_BidirectionalMultipleRelation() { var propertyAccessor = _bidirectionalMultipleRelationReflector .GetPropertyAccessExpression(typeof(IMixinTypeWithDomainObjectAttributes_AnnotatedPropertiesPartOfInterface)).Compile(); using (ClientTransaction.CreateRootTransaction().EnterDiscardingScope()) { var obj = MixinTarget_AnnotatedPropertiesPartOfInterface.NewObject(); var propertyValue = TestDomainObject.NewObject(); ((IMixinTypeWithDomainObjectAttributes_AnnotatedPropertiesPartOfInterface)obj).BidirectionalMultiplePropertyWithMandatoryAttribute.Add(propertyValue); var result = propertyAccessor(obj); Assert.That(result, Is.EqualTo(new[] { propertyValue })); } }
public void GetPropertyAccessExpression_NonRelationIntProperty() { var propertyAccessor = _intPropertyReflector .GetPropertyAccessExpression(typeof(IMixinTypeWithDomainObjectAttributes_AnnotatedPropertiesPartOfInterface)).Compile(); using (ClientTransaction.CreateRootTransaction().EnterDiscardingScope()) { var obj = MixinTarget_AnnotatedPropertiesPartOfInterface.NewObject(); var propertyValue = 10; ((IMixinTypeWithDomainObjectAttributes_AnnotatedPropertiesPartOfInterface)obj).IntProperty = propertyValue; var result = propertyAccessor(obj); Assert.That(result, Is.EqualTo(propertyValue)); } }
public void GetPropertyAccessExpression_BidirectionalMultipleRelation_NotLoaded() { var propertyAccessor = _bidirectionalMultipleRelationReflector .GetPropertyAccessExpression(typeof(IMixinTypeWithDomainObjectAttributes_AnnotatedPropertiesPartOfInterface)).Compile(); using (ClientTransaction.CreateRootTransaction().EnterDiscardingScope()) { var obj = (IMixinTypeWithDomainObjectAttributes_AnnotatedPropertiesPartOfInterface)MixinTarget_AnnotatedPropertiesPartOfInterface.NewObject(); using (ClientTransaction.Current.CreateSubTransaction().EnterDiscardingScope()) { var result = propertyAccessor(obj) as IEnumerable <object>; Assert.That(result, Is.Not.Null); Assert.That(result.Select(r => r.GetType().Name), Is.EqualTo(new[] { "FakeDomainObject" })); } } }