Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestMethodClassBaseDLaB"/> class.
 /// </summary>
 protected TestMethodClassBaseDLaB()
 {
     AssumedEntities = new Assumptions.AssumedEntities();
     EntityIds       = new Dictionary <string, List <Guid> >();
     EnableServiceExecutionTracing = true;
     MultiThreadPostDeletion       = true;
 }
Esempio n. 2
0
        /// <summary>
        /// Validates the assumption attributes of the given type(s)
        /// </summary>
        /// <param name="service">The service.</param>
        /// <param name="types">The type(s) that has/have EntityDataAssumptionBaseAttribute Attributes</param>
        public static AssumedEntities Load(IOrganizationService service, params Type[] types)
        {
            var assumedEntities = new AssumedEntities();

            foreach (var type in types)
            {
                foreach (var entityAssumption in type.GetCustomAttributes(true)
                         .Select(a => a as EntityDataAssumptionBaseAttribute)
                         .Where(a => a != null))
                {
                    assumedEntities.Load(service, entityAssumption);
                }
            }

            return(assumedEntities);
        }
        /// <summary>
        /// Adds the assumed entities with pre req infinite loop prevention.
        /// </summary>
        /// <param name="service">The service.</param>
        /// <param name="assumedEntities">The assumed entities.</param>
        /// <param name="currentlyProcessingPreReqs">The currently processing pre reqs.</param>
        protected void AddAssumedEntitiesWithPreReqInfiniteLoopPrevention(IOrganizationService service, AssumedEntities assumedEntities,
                                                                          HashSet <Type> currentlyProcessingPreReqs)
        {
            _assumedEntities            = assumedEntities;
            _currentlyProcessingPreReqs = currentlyProcessingPreReqs;
            var type = GetType();

            if (_assumedEntities.Contains(this))
            {
                return;
            }
            if (_currentlyProcessingPreReqs.Contains(type))
            {
                ThrowErrorPreventingInfiniteLoop(type);
            }
            _currentlyProcessingPreReqs.Add(type);
            AddPrerequisiteAssumptions(service);
            AddAssumedEntitiesInternal(service);
            _currentlyProcessingPreReqs.Remove(type);
        }
 /// <summary>
 /// Adds the entities assumed to exist to the AssumedEntities Collection
 /// </summary>
 /// <param name="service"></param>
 /// <param name="assumedEntities">Collection of Assumptions that have already been verified to be true</param>
 /// <returns></returns>
 public void AddAssumedEntities(IOrganizationService service, AssumedEntities assumedEntities)
 {
     AddAssumedEntitiesWithPreReqInfiniteLoopPrevention(service, assumedEntities, new HashSet <Type>());
 }