コード例 #1
0
 public PSSmartGroup(SmartGroup smartGroup)
 {
     Id                   = smartGroup.Id;
     Name                 = smartGroup.Name;
     AlertsCount          = (int?)smartGroup.AlertsCount;
     State                = smartGroup.SmartGroupState;
     Severity             = smartGroup.Severity;
     LastModifiedTime     = smartGroup.LastModifiedDateTime;
     LastModifiedUserName = smartGroup.LastModifiedUserName;
     Resources            = smartGroup.Resources;
     ResourceGroups       = smartGroup.ResourceGroups;
     ResourceTypes        = smartGroup.ResourceTypes;
     MonitorConditions    = smartGroup.MonitorConditions;
     MonitorServices      = smartGroup.MonitorServices;
     AlertSeverities      = smartGroup.AlertSeverities;
     AlertStates          = smartGroup.AlertStates;
 }
コード例 #2
0
        public void SmartGroupStateChangeTest()
        {
            using (MockContext context = MockContext.Start(this.GetType().FullName))
            {
                var alertsManagementClient = GetAlertsManagementClient(context, handler);

                string smartGroupId = "b15afb0c-4f70-477b-872a-f383b4065d40";

                // Get smart group by ID
                SmartGroup actualSmartGroup = alertsManagementClient.SmartGroups.GetById(smartGroupId);

                if (!this.IsRecording)
                {
                    Assert.Equal(AlertState.New, actualSmartGroup.SmartGroupState);
                }

                // Perform state change operation
                string     updatedState = AlertState.Closed;
                SmartGroup smartGroupPostStateChange = alertsManagementClient.SmartGroups.ChangeState(smartGroupId, updatedState);

                // Verify the state change operation was successful
                if (!this.IsRecording)
                {
                    Assert.Equal(updatedState, smartGroupPostStateChange.SmartGroupState);
                }

                // Get History of smart group
                var smartGroupHistory = alertsManagementClient.SmartGroups.GetHistory(smartGroupId);

                // Check if the history contains the state update event
                if (!this.IsRecording)
                {
                    CheckHistoryContainsStateChangeEvent(smartGroupHistory);
                }
            }
        }