/// <summary> /// Sets the orphan mapping behavior for the specified entity type. /// </summary> /// <param name="context">The deployment context.</param> /// <param name="entityTypeId">The ID of the entity type.</param> /// <param name="behavior">The orphan mapping behavior.</param> public static void EntityTypeOrphanMappingBehavior( this IDeploymentContext context, Guid entityTypeId, OrphanMappingBehavior behavior) { ArgumentValidator.EnsureArgumentNotNull(context, nameof(context)); ArgumentValidator.EnsureArgumentNotEmpty(entityTypeId, nameof(entityTypeId)); ValidateOrphanMappingBehavior(behavior); context.EntityTypeParameter( entityTypeId, OrphanMappingBehaviorParameterName, behavior.ToString()); }
/// <summary> /// Sets the orphan mapping behavior for the specified source system. /// </summary> /// <param name="context">The deployment context.</param> /// <param name="sourceSystemId">The ID of the source (external) system.</param> /// <param name="behavior">The orphan mapping behavior.</param> public static void SourceSystemOrphanMappingBehavior( this IDeploymentContext context, Guid sourceSystemId, OrphanMappingBehavior behavior) { ArgumentValidator.EnsureArgumentNotNull(context, nameof(context)); ArgumentValidator.EnsureArgumentNotEmpty( sourceSystemId, nameof(sourceSystemId)); ValidateOrphanMappingBehavior(behavior); context.SourceSystemParameter( sourceSystemId, OrphanMappingBehaviorParameterName, behavior.ToString()); }
private void OrphanMappingBehaviorCreatesEntityTypeSourceSystemParameter( OrphanMappingBehavior behavior) { // arrange var context = new Mock <IDeploymentContext>(MockBehavior.Strict); Guid entityTypeId = Guid.NewGuid(); Guid sourceSystemId = Guid.NewGuid(); context .Setup(dc => dc.EntityTypeSourceSystemParameter( entityTypeId, sourceSystemId, DeploymentContextExtensions.OrphanMappingBehaviorParameterName, behavior.ToString())) .Verifiable(); // act context.Object.OrphanMappingBehavior(entityTypeId, sourceSystemId, behavior); // assert context.Verify(); }
private void DestinationSystemOrphanMappingBehaviorCreatesDestinationSystemParameter( OrphanMappingBehavior behavior) { // arrange var context = new Mock <IDeploymentContext>(MockBehavior.Strict); Guid destinationSystemId = Guid.NewGuid(); context .Setup(dc => dc.DestinationSystemParameter( destinationSystemId, DeploymentContextExtensions.OrphanMappingBehaviorParameterName, behavior.ToString())) .Verifiable(); // act context .Object .DestinationSystemOrphanMappingBehavior( destinationSystemId, behavior); // assert context.Verify(); }