Beispiel #1
0
        /// <summary>
        /// Validate the integrity of this entity.
        /// </summary>
        public override void Validate(IEntity validationRoot, ValidationResults results)
        {
            base.Validate(validationRoot, results);
            toBlock.Validate(validationRoot, results);
            toEdge.Validate(validationRoot, results);
            fromBlock.Validate(validationRoot, results);
            fromEdge.Validate(validationRoot, results);
            enteringDestinationTrigger.Validate(validationRoot, results);
            destinationReachedTrigger.Validate(validationRoot, results);

            if (From == null)
            {
                results.Warn(this, Strings.WarnNoFromEndPointSpecified);
            }
            if (To == null)
            {
                results.Warn(this, Strings.WarnNoToEndPointSpecified);
            }
            if ((To == From) && (To != null))
            {
                results.Warn(this, Strings.WarnToEndPointEqualsFromEndPoint);
            }

            crossingJunctions.Validate(validationRoot, results);
            events.Validate(validationRoot, results);
            _enteringSensors.Validate(validationRoot, results);
            _reachedSensors.Validate(validationRoot, results);

            var enterEventCount   = events.Count(evt => evt.Behaviors.Any(x => x.StateBehavior == RouteStateBehavior.Enter));
            var reachedEventCount = events.Count(evt => evt.Behaviors.Any(x => x.StateBehavior == RouteStateBehavior.Reached));

            if ((enterEventCount == 0) && (reachedEventCount == 0) && this.IsInternal())
            {
                results.Warn(this, Strings.WarnNoSensorsSpecified);
            }
            else if ((reachedEventCount == 0) && this.IsToInternal())
            {
                results.Warn(this, Strings.WarnNoReachedDestinationSensorsSpecified);
            }
            else if ((enterEventCount == 0) && this.IsToInternal())
            {
                results.Warn(this, Strings.WarnNoEnteringDestinationSensorsSpecified);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Validate the integrity of this entity.
 /// </summary>
 public override void Validate(IEntity validationRoot, ValidationResults results)
 {
     base.Validate(validationRoot, results);
     activateTrigger.Validate(validationRoot, results);
     deActivateTrigger.Validate(validationRoot, results);
 }