Пример #1
0
        /// <summary>
        /// Initializes a new instance of the PSUsageMetric class.
        /// </summary>
        /// <param name="usageMetric">The input UsageMetric object</param>
        public PSUsageMetric(UsageMetric usageMetric) : base(name: usageMetric.Name)
        {
            this.Name = usageMetric.Name != null ? usageMetric.Name.LocalizedValue : null;

            this.CurrentValue = usageMetric.CurrentValue;
            this.Limit = usageMetric.Limit;
            this.NextResetTime = usageMetric.NextResetTime;
            this.QuotaPeriod = usageMetric.QuotaPeriod;
            this.Unit = usageMetric.Unit;
            this.Id = usageMetric.Id;
        }
        /// <summary>
        /// Initializes a new instance of the PSUsageMetric class.
        /// </summary>
        /// <param name="usageMetric">The input UsageMetric object</param>
        public PSUsageMetric(UsageMetric usageMetric)
        {
            // Keep the original value (localized string, Dictionary, List) in the base
            base.Name = usageMetric.Name;

            this.CurrentValue = usageMetric.CurrentValue;
            this.Limit = usageMetric.Limit;
            this.Name = usageMetric.Name != null ? usageMetric.Name.LocalizedValue : null;
            this.NextResetTime = usageMetric.NextResetTime;
            this.QuotaPeriod = usageMetric.QuotaPeriod;
            this.Unit = usageMetric.Unit;
        }
 private static void AreEqual(UsageMetric exp, UsageMetric act)
 {
     if (exp != null)
     {
         Assert.Equal(exp.CurrentValue, act.CurrentValue);
         Assert.Equal(exp.Limit, act.Limit);
         Assert.Equal(exp.NextResetTime, act.NextResetTime);
         Assert.Equal(exp.QuotaPeriod, act.QuotaPeriod);
         Assert.Equal(exp.Unit, act.Unit);
         AreEqual(exp.Name, act.Name);
     }
 }