Пример #1
0
 private void ExpectHandleReference(ICloneStrategy strategyMock, TestDomainBase original, TestDomainBase clone, string propertyName,
                                    ClientTransaction sourceTransaction, ClientTransaction cloneTransaction)
 {
     strategyMock.HandleReference(new PropertyAccessor(), new PropertyAccessor(), null);
     LastCall.Constraints(
         Rhino.Mocks.Constraints.Is.Equal(original.Properties[original.GetPublicDomainObjectType(), propertyName, sourceTransaction]),
         Rhino.Mocks.Constraints.Is.Equal(clone.Properties[clone.GetPublicDomainObjectType(), propertyName, cloneTransaction]),
         Rhino.Mocks.Constraints.Is.Anything());
 }
Пример #2
0
 private void CopyProperties(
     PropertyIndexer sourceProperties,
     ClientTransaction sourceTransaction,
     IEnumerable <PropertyAccessor> cloneProperties,
     ICloneStrategy strategy,
     CloneContext context)
 {
     foreach (PropertyAccessor cloneProperty in cloneProperties)
     {
         PropertyAccessor sourceProperty = sourceProperties[cloneProperty.PropertyData.PropertyIdentifier, sourceTransaction];
         if (cloneProperty.PropertyData.Kind == PropertyKind.PropertyValue)
         {
             object sourceValue = sourceProperty.GetValueWithoutTypeCheck();
             cloneProperty.SetValueWithoutTypeCheck(sourceValue);
         }
         else if (strategy != null && !cloneProperty.HasBeenTouched)
         {
             strategy.HandleReference(sourceProperty, cloneProperty, context);
         }
     }
 }