/// <summary> /// User wishes to add a new distribution list to Connection - this routine shows a modal form for gathering the name, alias and optionally /// an extension number and then adds the new list and shows it in the grid by itself. /// </summary> private void buttonAddItem_Click(object sender, EventArgs e) { using (FormNewDistributionListInfo oForm = new FormNewDistributionListInfo()) { if (oForm.ShowDialog() != DialogResult.OK) { return; } //the call can take a minute to return - disable controls on the form to indicate we're busy. DisableFormControls(); WebCallResult res = DistributionList.AddDistributionList(GlobalItems.CurrentConnectionServer, oForm.DisplayName, oForm.Alias, oForm.Extension, null); EnableFormControls(); if (res.Success) { //force a refresh of the grid and then select the list you just added - the ObjectId of the newly added list is returned //in the WebCallResult structure as the ReturnObjectID. _currentPage = 0; UpdateDataDisplay(res.ReturnedObjectId); Logger.Log(string.Format("New distribution list added:{0},{1}", oForm.DisplayName, res.ReturnedObjectId)); } else { Logger.Log(string.Format(string.Format("New distribution list add failed:{0}\r\n{1}", oForm.DisplayName, res.ToString()))); MessageBox.Show(String.Format("Error adding new distribution list: {0}\r\nresponse from CUPI: {1}", res.ErrorText, res.ResponseText)); } } }
public void DistributionList_CreateWithInvalidExtension() { string strAlias = Guid.NewGuid().ToString().Replace("-", ""); DistributionList oList; var res = DistributionList.AddDistributionList(_connectionServer, strAlias, strAlias, strAlias, null, out oList); Assert.IsFalse(res.Success, "Creating list with invalid extension should fail:" + res); }
public new static void MyClassInitialize(TestContext testContext) { BaseIntegrationTests.MyClassInitialize(testContext); //create new list with GUID in the name to ensure uniqueness String strName = "TempList_" + Guid.NewGuid().ToString().Replace("-", ""); WebCallResult res = DistributionList.AddDistributionList(_connectionServer, strName, strName, "", null, out _tempList); Assert.IsTrue(res.Success, "Failed creating temporary distribution list:" + res.ToString()); }
public void AddDistributionList_EmptyAliasAndName_Failure() { var res = DistributionList.AddDistributionList(_mockServer, "", "", "123", null); Assert.IsFalse(res.Success, "AddDistributionList failed to catch empty alias and display name params"); }
public void AddDistributionList_NullConnectionServer_Failure() { WebCallResult res = DistributionList.AddDistributionList(null, "aaa", "aaa", "123", null); Assert.IsFalse(res.Success, "AddDistributionList failed to catch null ConnectionServerRest object"); }