コード例 #1
0
        public override void Execute()
        {
            MAObjectHologram sourceObject = this.GetObjectFromAlias();

            Rule.RuleFailedEvent           += RuleBase_RuleFailedEvent;
            RuleGroup.RuleGroupFailedEvent += RuleGroup_RuleGroupFailedEvent;
            try
            {
                if (!this.SuccessCriteria.Evaluate(sourceObject))
                {
                    Logger.WriteLine("The unit test evaluation {0} failed", this.Name);
                    Logger.WriteSeparatorLine('-');
                    Logger.WriteLine("MAObject drop");
                    Logger.WriteRaw(sourceObject.AttributeDataToString());
                    Logger.WriteSeparatorLine('-');

                    throw new EvaluationFailedException();
                }
            }
            finally
            {
                Rule.RuleFailedEvent           -= RuleBase_RuleFailedEvent;
                RuleGroup.RuleGroupFailedEvent -= RuleGroup_RuleGroupFailedEvent;
            }
        }