/// <summary> /// Determines whether the domain object contains a property with the specified short name and declaring type. /// </summary> /// <param name="domainObjectType">The type declaring the property with the given <paramref name="shortPropertyName"/>.</param> /// <param name="shortPropertyName">The short property name to check for.</param> /// <returns> /// True if the domain object contains a property named as specified by <paramref name="shortPropertyName"/> declared on /// <paramref name="domainObjectType"/>; otherwise, false. /// </returns> public bool Contains([NotNull] Type domainObjectType, [NotNull] string shortPropertyName) { ArgumentUtility.CheckNotNull("domainObjectType", domainObjectType); ArgumentUtility.CheckNotNullOrEmpty("shortPropertyName", shortPropertyName); return(PropertyAccessorDataCache.GetPropertyAccessorData(domainObjectType, shortPropertyName) != null); }
public void ResolveMandatoryPropertyAccessorData_Expression_Mixin_ViaMixin() { var cacheWithMixins = new PropertyAccessorDataCache(GetTypeDefinition(typeof(TargetClassForPersistentMixin))); var data = cacheWithMixins.ResolveMandatoryPropertyAccessorData((TargetClassForPersistentMixin t) => (Mixin.Get <MixinAddingPersistentProperties> (t).PersistentProperty)); Assert.That(data, Is.Not.Null); Assert.That(data, Is.EqualTo(cacheWithMixins.GetPropertyAccessorData(typeof(MixinAddingPersistentProperties).FullName + ".PersistentProperty"))); }
public void ResolvePropertyAccessorData_PropertyInformation_Mixin_ViaMixin() { var cacheWithMixins = new PropertyAccessorDataCache(GetTypeDefinition(typeof(TargetClassForPersistentMixin))); var propertyinformation = PropertyInfoAdapter.Create(typeof(MixinAddingPersistentProperties).GetProperty("PersistentProperty")); var data = cacheWithMixins.ResolvePropertyAccessorData(propertyinformation); Assert.That(data, Is.Not.Null); Assert.That(data, Is.EqualTo(cacheWithMixins.GetPropertyAccessorData(typeof(MixinAddingPersistentProperties).FullName + ".PersistentProperty"))); }
public void FindPropertyAccessorData_FromDerivedType() { Assert.That(_distributorCache.GetPropertyAccessorData(typeof(Distributor), "ContactPerson"), Is.Null); var result = _distributorCache.FindPropertyAccessorData(typeof(Distributor), "ContactPerson"); var expected = _distributorCache.GetMandatoryPropertyAccessorData(typeof(Partner), "ContactPerson"); Assert.That(result, Is.EqualTo(expected)); }
public void ResolveMandatoryPropertyAccessorData_Expression_Mixin_ViaInterface() { var cacheWithMixins = new PropertyAccessorDataCache(GetTypeDefinition(typeof(TargetClassForPersistentMixin))); // ReSharper disable SuspiciousTypeConversion.Global var data = cacheWithMixins.ResolveMandatoryPropertyAccessorData((TargetClassForPersistentMixin t) => ((IMixinAddingPersistentProperties)t).PersistentProperty); // ReSharper restore SuspiciousTypeConversion.Global Assert.That(data, Is.Not.Null); Assert.That(data, Is.EqualTo(cacheWithMixins.GetPropertyAccessorData(typeof(MixinAddingPersistentProperties).FullName + ".PersistentProperty"))); }
public void FindPropertyAccessorData_FromGenericType() { Assert.That( _closedGenericClassCache.GetPropertyAccessorData(typeof(ClosedGenericClassWithManySideRelationProperties), "BaseUnidirectional"), Is.Null); var result = _closedGenericClassCache.FindPropertyAccessorData(typeof(ClosedGenericClassWithManySideRelationProperties), "BaseUnidirectional"); var expected = _closedGenericClassCache.GetMandatoryPropertyAccessorData( typeof(GenericClassWithManySideRelationPropertiesNotInMapping <>), "BaseUnidirectional"); Assert.That(result, Is.EqualTo(expected)); }
/// <summary> /// Determines whether the domain object contains a property with the specified identifier. /// </summary> /// <param name="propertyIdentifier">The long property identifier to check for.</param> /// <returns> /// True if the domain object contains a property named as specified by <paramref name="propertyIdentifier"/>; otherwise, false. /// </returns> public bool Contains([NotNull] string propertyIdentifier) { ArgumentUtility.CheckNotNullOrEmpty("propertyIdentifier", propertyIdentifier); return(PropertyAccessorDataCache.GetPropertyAccessorData(propertyIdentifier) != null); }
public void GetPropertyAccessorData_ValueProperty() { var data = _orderCache.GetPropertyAccessorData(typeof(Order) + ".OrderNumber"); Assert.That(data, Is.Not.Null); Assert.That(data.PropertyIdentifier, Is.EqualTo(typeof(Order) + ".OrderNumber")); Assert.That(data.Kind, Is.EqualTo(PropertyKind.PropertyValue)); }