Beispiel #1
0
        public void AlertsSummaryTest()
        {
            using (MockContext context = MockContext.Start(this.GetType()))
            {
                var alertsManagementClient = GetAlertsManagementClient(context, handler);

                // Get alerts summary grouped by severity and state
                string groupBy = "severity,alertState";
                var    summary = alertsManagementClient.Alerts.GetSummary(groupby: groupBy);

                if (!this.IsRecording)
                {
                    Assert.NotNull(summary.Properties.Total);
                    Assert.Equal("severity", summary.Properties.Groupedby);

                    IEnumerator <AlertsSummaryGroupItem> enumerator = summary.Properties.Values.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        AlertsSummaryGroupItem current = enumerator.Current;
                        IsValidSeverity(current.Name);
                        Assert.NotNull(current.Count);
                        Assert.Equal("alertState", current.Groupedby);
                        IEnumerator <AlertsSummaryGroupItem> stateEnumerator = current.Values.GetEnumerator();
                        while (stateEnumerator.MoveNext())
                        {
                            AlertsSummaryGroupItem currentstate = stateEnumerator.Current;
                            IsValidAlertState(currentstate.Name);
                            Assert.NotNull(currentstate.Count);
                        }
                    }
                }
            }
        }
 public static void AreEqual(AlertsSummaryGroupItem exp, AlertsSummaryGroupItem act)
 {
     if (exp != null)
     {
         Assert.Equal(exp.Name, act.Name);
         Assert.Equal(exp.Count, act.Count);
         Assert.Equal(exp.Groupedby, act.Groupedby);
         AreEqual(exp.Values, act.Values);
     }
 }