Ejemplo n.º 1
0
        internal override int GetRecurciveHashCode(ReferenceHashSet <Content> visitedContents)
        {
            int hash = base.GetHashCode();

            hash = HashHelper.CombineHashCodes(hash, PreloadingMode.GetHashCode());

            if (RelationCondition != null)
            {
                hash = HashHelper.CombineHashCodes(hash, RelationCondition.GetHashCode());
            }
            if (ClonePrototypeCondition != null)
            {
                hash = HashHelper.CombineHashCodes(hash, ClonePrototypeCondition.GetHashCode());
            }
            if (Content != null)
            {
                hash = HashHelper.CombineHashCodes(hash, Content.GetRecurciveHashCode(visitedContents));
            }
            if (CloneDefinition != null)
            {
                hash = HashHelper.CombineHashCodes(hash, CloneDefinition.GetRecurciveHashCode(visitedContents));
            }

            return(hash);
        }
Ejemplo n.º 2
0
        protected override void DeepCopyMembers(Field field, ReferenceDictionary <object, object> visited)
        {
            base.DeepCopyMembers(field, visited);
            var entityField = (EntityField)field;

            entityField.CloneDefinition = CloneDefinition?.DeepCopy(visited);
            entityField.Content         = Content?.DeepCopy(visited);
        }
Ejemplo n.º 3
0
        public void ReturnedDefinitionIsExpected()
        {
            ICloneDefinition <PrimitiveEntity> actual = TestObject.Create <PrimitiveEntity>(MockCloneFactory.Object);

            Assert.IsInstanceOfType(actual, typeof(CloneDefinition <PrimitiveEntity>));
            CloneDefinition <PrimitiveEntity> actualDefinition = (CloneDefinition <PrimitiveEntity>)actual;

            Assert.AreSame(MockCloneFactory.Object, actualDefinition.CloneFactory);
            Assert.AreSame(MockCloneDelegate.Object, actualDefinition.CloneDelegate);
        }
Ejemplo n.º 4
0
        public void Init()
        {
            MockCloneDelegate
            .Setup(cloneDelegate => cloneDelegate(It.IsAny <PrimitiveEntity>(), It.IsAny <ICloneFactory>()))
            .Returns(TestClonedEntity);

            TestObject = new CloneDefinition <PrimitiveEntity>(
                MockCloneFactory.Object,
                MockCloneDelegate.Object);
        }
Ejemplo n.º 5
0
 internal override bool RecursiveEquals(Field other, ReferenceDictionary <Content, Content> visitedContents)
 {
     return(base.RecursiveEquals(other, visitedContents) &&
            PreloadingMode == ((EntityField)other).PreloadingMode &&
            RelationCondition == ((EntityField)other).RelationCondition &&
            ClonePrototypeCondition == ((EntityField)other).ClonePrototypeCondition &&
            Content.RecursiveEquals(((EntityField)other).Content, visitedContents) &&
            (CloneDefinition == null
                ? ((EntityField)other).CloneDefinition == null
                : CloneDefinition.RecursiveEquals(((EntityField)other).CloneDefinition, visitedContents)));
 }