public void SetNotificationPreferences() { Assert.IsNotNull(TestData.NotificationPreferencesResponse); ApplicationDeliveryPreferencesType appPref = TestData.NotificationPreferencesResponse.ApplicationDeliveryPreferences; appPref.NotificationPayloadType = NotificationPayloadTypeCodeType.eBLSchemaSOAP; NotificationEnableTypeCollection userPref = TestData.NotificationPreferencesResponse.UserDeliveryPreferenceArray; SetNotificationPreferencesCall api = new SetNotificationPreferencesCall(this.apiContext); api.ApplicationDeliveryPreferences = appPref; api.UserDeliveryPreferenceList = userPref; // Make API call. ApiException gotException = null; try { api.Execute(); } catch(ApiException ex) { gotException = ex; } if( gotException != null ) { Assert.IsTrue(appPref == null && userPref == null); } }
private void BtnSetNotificationPreferences_Click(object sender, System.EventArgs e) { try { TxtStatus.Text = ""; SetNotificationPreferencesCall apicall = new SetNotificationPreferencesCall(Context); apicall.ApplicationDeliveryPreferences = new ApplicationDeliveryPreferencesType(); apicall.ApplicationDeliveryPreferences.ApplicationEnable = (EnableCodeType) Enum.Parse(typeof(EnableCodeType), CboStatus.SelectedItem.ToString()); if (TxtUrl.Text.Length > 0) apicall.ApplicationDeliveryPreferences.ApplicationURL = TxtUrl.Text; NotificationEnableTypeCollection notifications = new NotificationEnableTypeCollection(); for (int inx = 0; inx < LblEvents.Length; inx++) { NotificationEnableType net = new NotificationEnableType(); net.EventType = (NotificationEventTypeCodeType) Enum.Parse(typeof(NotificationEventTypeCodeType), LblEvents[inx].Text); net.EventEnable = (EnableCodeType) Enum.Parse(typeof(EnableCodeType), CboEventStatus[inx].SelectedItem.ToString()); notifications.Add(net); } apicall.SetNotificationPreferences(notifications); TxtStatus.Text = apicall.ApiResponse.Ack.ToString(); } catch(Exception ex) { MessageBox.Show(ex.Message); } }