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); }
public TEntity Clone <TEntity>(TEntity source) where TEntity : class { if (!Definitions.ContainsKey(typeof(TEntity))) { AddNewDefinition <TEntity>(); } ICloneDefinition <TEntity> definition = Definitions[typeof(TEntity)] as ICloneDefinition <TEntity>; return(definition.Clone(source)); }