/// <summary>
        /// Initializes a new instance of the PSRuleProperties class.
        /// </summary>
        /// <param name="properties"></param>
        public PSAlertRuleProperty(Rule properties)
        {
            this.Actions = properties.Actions;

            var condition = properties.Condition as ThresholdRuleCondition;
            if (condition != null)
            {
                this.Condition = new PSThresholdRuleCondition(condition);
            }
            else
            {
                var eventCondition = properties.Condition as ManagementEventRuleCondition;
                if (eventCondition != null)
                {
                    this.Condition = new PSEventRuleCondition(eventCondition);
                }
                else
                {
                    var locationCondition = properties.Condition as LocationThresholdRuleCondition;
                    if (locationCondition != null)
                    {
                        this.Condition = new PSLocationThresholdRuleCondition(locationCondition);
                    }
                    else
                    {
                        throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, ResourcesForAlertCmdlets.RuleConditionTypeNotSupported, properties.Condition.GetType().Name));
                    }
                }
            }

            this.Description = properties.Description;
            this.Status = properties.IsEnabled ? "Enabled" : "Disabled";
            this.Name = properties.Name;
        }
 private void AreEqual(Rule exp, Rule act)
 {
     if (exp != null)
     {
         AreEqual(exp.Action, act.Action);
         AreEqual(exp.Condition, act.Condition);
         Assert.Equal(exp.Description, act.Description);
         Assert.Equal(exp.IsEnabled, act.IsEnabled);
         Assert.Equal(exp.LastUpdatedTime.ToUniversalTime(), act.LastUpdatedTime.ToUniversalTime());
         Assert.Equal(exp.Name, act.Name);
     }
 }