public void CanCloneEntityWithPrimitives() { ICloneFactory testObject = TestServiceProvider.GetRequiredService <ICloneFactory>(); PrimitiveEntity actual = testObject.Clone(TestPrimitiveEntity); VerifyPrimitiveEntityWasCloned(actual); }
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); }
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); } }