Esempio n. 1
0
        public void CanCloneEntityWithPrimitives()
        {
            ICloneFactory testObject = TestServiceProvider.GetRequiredService <ICloneFactory>();

            PrimitiveEntity actual = testObject.Clone(TestPrimitiveEntity);

            VerifyPrimitiveEntityWasCloned(actual);
        }
Esempio n. 2
0
        public void CanCloneEntityWithComplexTypes()
        {
            ICloneFactory testObject = TestServiceProvider.GetRequiredService <ICloneFactory>();

            ComplexEntity actual = testObject.Clone(TestComplexEntity);

            Assert.AreNotSame(TestComplexEntity, actual);
            Assert.AreEqual(TestComplexEntity.TestInt, actual.TestInt);
            Assert.AreNotSame(TestComplexEntity.TestPrimitiveEntity, actual.TestPrimitiveEntity);
            VerifyPrimitiveEntityWasCloned(actual.TestPrimitiveEntity);
        }
Esempio n. 3
0
        public void CanCloneEntityWithCollections(int testEntitiesInCollection)
        {
            CollectionEntity testEntity = new CollectionEntity(testEntitiesInCollection);
            ICloneFactory    testObject = TestServiceProvider.GetRequiredService <ICloneFactory>();

            CollectionEntity actual = testObject.Clone(testEntity);

            Assert.AreNotSame(testEntity, actual);
            Assert.AreEqual(testEntitiesInCollection, actual.IntArray.Length);
            Assert.AreEqual(testEntitiesInCollection, actual.PrimitiveEntityArray.Length);
            Assert.AreEqual(testEntitiesInCollection, actual.ComplexEntityArray.Length);
            Assert.AreEqual(testEntitiesInCollection, actual.LongList.Count);
            Assert.AreEqual(testEntitiesInCollection, actual.PrimitiveEntityList.Count);
            Assert.AreEqual(testEntitiesInCollection, actual.ComplexEntityList.Count);
            for (int i = 0; i < testEntitiesInCollection; i++)
            {
                VerifyIndexWasCloned(testEntity, actual, i);
            }
        }