/// <summary> /// Execute the cmdlet /// </summary> public override void ExecuteCmdlet() { Utilities.ValidateUri(this.ServiceUri, "ServiceUri"); var dictionary = this.Properties == null ? new Dictionary<string, string>() : this.Properties.Keys.Cast<object>().ToDictionary(key => (string)key, key => (string)this.Properties[key]); var action = new WebhookNotification { ServiceUri = this.ServiceUri, Properties = dictionary }; WriteObject(action); }
public void NewAzureRmAutoscaleNotificationCommandParametersProcessing() { Assert.Throws<ArgumentException>(() => Cmdlet.ExecuteCmdlet()); Cmdlet.SendEmailToSubscriptionAdministrator = true; Cmdlet.ExecuteCmdlet(); Cmdlet.SendEmailToSubscriptionAdministrator = false; Cmdlet.SendEmailToSubscriptionCoAdministrators = true; Cmdlet.ExecuteCmdlet(); Cmdlet.SendEmailToSubscriptionCoAdministrators = false; Cmdlet.CustomEmails = new string[0]; Assert.Throws<ArgumentException>(() => Cmdlet.ExecuteCmdlet()); Cmdlet.CustomEmails = new string[] {"*****@*****.**"}; Cmdlet.ExecuteCmdlet(); Cmdlet.CustomEmails = new string[] {"*****@*****.**", "*****@*****.**"}; Cmdlet.ExecuteCmdlet(); Cmdlet.CustomEmails = null; Cmdlet.Webhooks = new WebhookNotification[0]; Assert.Throws<ArgumentException>(() => Cmdlet.ExecuteCmdlet()); var notification = new WebhookNotification { ServiceUri = "http://hello.com", Properties = null }; Cmdlet.Webhooks = new WebhookNotification[] { notification }; Cmdlet.ExecuteCmdlet(); Cmdlet.SendEmailToSubscriptionAdministrator = true; Cmdlet.ExecuteCmdlet(); Cmdlet.SendEmailToSubscriptionCoAdministrators = true; Cmdlet.ExecuteCmdlet(); }