Ejemplo n.º 1
0
        /// <summary>
        /// add a new call handler using the FormNewCallHandler to gather details for it.
        /// </summary>
        private void buttonAddItem_Click(object sender, EventArgs e)
        {
            using (FormNewCallHandlerInfo oForm = new FormNewCallHandlerInfo())
            {
                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 = CallHandler.AddCallHandler(GlobalItems.CurrentConnectionServer,
                                                               oForm.TemplateObjectID,
                                                               oForm.DisplayName,
                                                               oForm.Extension,
                                                               null);
                EnableFormControls();

                if (res.Success)
                {
                    //force a refresh of the grid and then select the handler you just added - the ObjectId of the newly added handler is returned
                    //in the WebCallResult structure as the ReturnObjectID.
                    _currentPage = 0;
                    UpdateDataDisplay(res.ReturnedObjectId);
                    Logger.Log(string.Format("New call handler added:{0},{1}", oForm.DisplayName, res.ReturnedObjectId));
                }
                else
                {
                    Logger.Log(string.Format(string.Format("New call handler add failed:{0}\r\n{1}", oForm.DisplayName, res.ToString())));
                    MessageBox.Show(String.Format("Error adding new call handler: {0}\r\nresponse from CUPI: {1}", res.ErrorText, res.ResponseText));
                }
            }
        }
Ejemplo n.º 2
0
        public void AddCallHandler_JunkObjectIdReturn_Failure()
        {
            //invalid objectId response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), It.IsAny <bool>())).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = "/vmrest/handlers/callhandlers/junk"
            });

            CallHandler oHandler;
            var         res = CallHandler.AddCallHandler(_mockServer, "templateid", "displayname", "1234", null, out oHandler);

            Assert.IsFalse(res.Success, "AddCallHandler that produces invalid new ObjectId did not fail");
        }
Ejemplo n.º 3
0
        public void AddCallHandlerFailure_InvalidExtension()
        {
            //grab the first template - should always be one and it doesn't matter which
            List <CallHandlerTemplate> oTemplates;
            WebCallResult res = CallHandlerTemplate.GetCallHandlerTemplates(_connectionServer, out oTemplates, 1, 1);

            if (res.Success == false || oTemplates == null || oTemplates.Count == 0)
            {
                Assert.Fail("Could not fetch call handler templates:" + res);
            }

            string strExtension = Guid.NewGuid().ToString();

            res = CallHandler.AddCallHandler(_connectionServer, oTemplates[0].ObjectId, strExtension, strExtension, null);
            Assert.IsFalse(res.Success, "Creating new call handler with invalid extension should fail");
        }
Ejemplo n.º 4
0
        public new static void MyClassInitialize(TestContext testContext)
        {
            BaseIntegrationTests.MyClassInitialize(testContext);

            //grab the first template - should always be one and it doesn't matter which
            List <CallHandlerTemplate> oTemplates;
            WebCallResult res = CallHandlerTemplate.GetCallHandlerTemplates(_connectionServer, out oTemplates);

            if (res.Success == false || oTemplates == null || oTemplates.Count == 0)
            {
                Assert.Fail("Could not fetch call handler templates:" + res);
            }

            //create new handler with GUID in the name to ensure uniqueness
            String strName = "TempHandler_" + Guid.NewGuid().ToString().Replace("-", "");

            res = CallHandler.AddCallHandler(_connectionServer, oTemplates[0].ObjectId, strName, "", null, out _tempHandler);
            Assert.IsTrue(res.Success, "Failed creating temporary callhandler:" + res.ToString());
        }
Ejemplo n.º 5
0
        public void AddCallHandler_NullConnectionServer_Failure()
        {
            WebCallResult res = CallHandler.AddCallHandler(null, "", "", "", null);

            Assert.IsFalse(res.Success, "AddCallHandler should fail if the ConnectionServerRest parameter is null");
        }
Ejemplo n.º 6
0
        public void AddCallHandler_EmptyDisplayName_Failure()
        {
            var res = CallHandler.AddCallHandler(_mockServer, "voicemailtemplate", "", "1234", null);

            Assert.IsFalse(res.Success, "AddCallHandler should fail if the DisplayName parameter is empty");
        }
Ejemplo n.º 7
0
        public void AddCallHandler_EmptyExtension_Failure()
        {
            var res = CallHandler.AddCallHandler(_mockServer, "voicemailtemplate", "aaa", "", null);

            Assert.IsFalse(res.Success, "AddCallHandler should fail if the extension parameter is empty");
        }
Ejemplo n.º 8
0
        public void AddCallHandler_EmptyTemplateId_Failure()
        {
            var res = CallHandler.AddCallHandler(_mockServer, "", "aaa", "123", null);

            Assert.IsFalse(res.Success, "AddCallHandler should fail if the template parameter is empty");
        }