public override bool Execute()
        {
            var changeAllMonitors = string.IsNullOrWhiteSpace(MonitorsNamesCollection);

            var monitorRetriver = new GetMonitors(SyntheticsApiKey);
            var monitorUpdater  = new UpdateMonitor(SyntheticsApiKey);

            Log.LogMessage("Starting API operations", MessageImportance.Low);

            var monitorsCollection = changeAllMonitors ? monitorRetriver.GetAllMonitors() : GetNamedMonitors(monitorRetriver, MonitorsNamesCollection);

            if (!monitorsCollection.Monitors.Any())
            {
                Log.LogMessage(MessageImportance.High, "Could not retrieve any monitors for given set of parameters");
                return(false);
            }


            for (int counter = 0; counter < monitorsCollection.Count; counter++)
            {
                var monitor     = monitorsCollection.Monitors[counter];
                var monitorName = !string.IsNullOrWhiteSpace(monitor.Name) ? monitor.Name : "UNRETRIEVABLE";
                Log.LogMessage(MessageImportance.Low, "Updating monitor '{0}' to status '{1}'", monitorName, GetTargetStatus(EnableMonitors));
                var updateStatus = monitorUpdater.Execute(monitor, EnableMonitors);
                if (!updateStatus)
                {
                    //failure encountered during monitor update
                    Log.LogError("Could change monitor '{0}' to status '{1}'", monitorName, GetTargetStatus(EnableMonitors));
                }
            }

            Log.LogMessage("Finished API operations", MessageImportance.Low);

            return(true);
        }
        private void ChangeMonitorsStatus(SyntheticsJsonRoot monitorsCollections, bool targetStatus)
        {
            var monitorUpdater = new UpdateMonitor(apiKey);

            foreach (var monitor in monitorsCollections.Monitors)
            {
                monitorUpdater.Execute(monitor, targetStatus);
            }
        }
        public void ChangeMonitorStatus()
        {
            var index   = new Random().Next(this.monitorsCollection.Count - 1);
            var monitor = this.monitorsCollection.Monitors[index];

            var currentStatus  = monitor.IsEnabled;
            var monitorUpdater = new UpdateMonitor(this.apiKey);

            //change monitor status to another
            monitorUpdater.Execute(monitor, !currentStatus);
            monitor = this.monitorRetriver.GetMonitorByName(monitor.Name);
            Assert.IsFalse(currentStatus.Equals(monitor.IsEnabled));
            //revert back
            currentStatus = monitor.IsEnabled;
            monitorUpdater.Execute(monitor, !currentStatus);
            monitor = this.monitorRetriver.GetMonitorByName(monitor.Name);
            Assert.IsFalse(currentStatus.Equals(monitor.IsEnabled));
        }