Esempio n. 1
0
        public void AddCallHandlerTemplate_EmptyRecipients_Failure()
        {
            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.AddCallHandlerTemplate(_mockServer, "displayname", "mediaswitchobjectid", "", "", null, out oTemplate);

            Assert.IsFalse(res.Success, "AddCallHandlerTemplate with no recipients did not fail");
        }
        public void CallHandlerTemplate_AddDeleteTest_UserRecipient()
        {
            List <PhoneSystem> oPhoneSystems;
            var res = PhoneSystem.GetPhoneSystems(_connectionServer, out oPhoneSystems, 1, 1);

            Assert.IsTrue(res.Success, "Failed to fetch phone systems:" + res);
            Assert.IsTrue(oPhoneSystems.Count == 1, "Failed to fetch single phone system");

            List <UserBase> oUsers;

            res = UserBase.GetUsers(_connectionServer, out oUsers, 1, 1);
            Assert.IsTrue(res.Success, "Failed to fetch users:" + res);
            Assert.IsTrue(oUsers.Count == 1, "Failed to fetch single user");

            string strName = "Temp_" + Guid.NewGuid().ToString();

            CallHandlerTemplate oTemplate;

            res = CallHandlerTemplate.AddCallHandlerTemplate(_connectionServer, strName, oPhoneSystems[0].ObjectId,
                                                             "", oUsers[0].ObjectId, null, out oTemplate);

            Assert.IsTrue(res.Success, "Failed creating new call handler template:" + res);

            res = oTemplate.Delete();
            Assert.IsTrue(res.Success, "Failed deleting call handler template:" + res);
        }
        public void CallHandlerTemplate_AddDeleteTest_ListRecipient()
        {
            List <PhoneSystem> oPhoneSystems;
            var res = PhoneSystem.GetPhoneSystems(_connectionServer, out oPhoneSystems, 1, 1);

            Assert.IsTrue(res.Success, "Failed to fetch phone systems:" + res);
            Assert.IsTrue(oPhoneSystems.Count == 1, "Failed to fetch single phone system");

            List <DistributionList> oLists;

            res = DistributionList.GetDistributionLists(_connectionServer, out oLists, 1, 1);
            Assert.IsTrue(res.Success, "Failed to fetch lists:" + res);
            Assert.IsTrue(oLists.Count == 1, "Failed to fetch single list");

            string strName = "Temp_" + Guid.NewGuid().ToString();

            CallHandlerTemplate oTemplate;

            res = CallHandlerTemplate.AddCallHandlerTemplate(_connectionServer, strName, oPhoneSystems[0].ObjectId,
                                                             oLists[0].ObjectId, "", null, out oTemplate);

            Assert.IsTrue(res.Success, "Failed creating new call handler template:" + res);

            res = oTemplate.Delete();
            Assert.IsTrue(res.Success, "Failed deleting call handler template:" + res);
        }
Esempio n. 4
0
        public void AddCallHandlerTemplate_EmptyMediaSwitchId_Failure()
        {
            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.AddCallHandlerTemplate(_mockServer, "displayname", "", "recipientlist", "recipientuser", null, out oTemplate);

            Assert.IsFalse(res.Success, "AddCallHandlerTemplate with empty mediaswitch objectId did not fail");
        }
Esempio n. 5
0
        public void AddCallHandlerTemplate_NullConnectionServer_Failure()
        {
            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.AddCallHandlerTemplate(null, "display name", "mediaswitchobjectid", "recipientlist", "recipientuser",
                                                                 null, out oTemplate);

            Assert.IsFalse(res.Success, "AddCallHandlerTemplate with null ConnectionServerRest did not fail");
        }
Esempio n. 6
0
        public void AddCallHandlerTemplate_ErrorResult_Failure()
        {
            //invalid objectId response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success    = false,
                StatusCode = 404,
            });

            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.AddCallHandlerTemplate(_mockServer, "test", "test", "", "test", null, out oTemplate);

            Assert.IsFalse(res.Success, "AddCallHandlerTemplate that produces error response did not fail");
        }
Esempio n. 7
0
        public void AddCallHandlerTemplate_EmptyResponse_Failure()
        {
            //invalid objectId response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = ""
            });

            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.AddCallHandlerTemplate(_mockServer, "test", "test", "", "test", null, out oTemplate);

            Assert.IsFalse(res.Success, "AddCallHandlerTemplate that returns empty response did not fail");
        }
Esempio n. 8
0
        public void AddCallHandlerTemplate_JunkObjectIdReturn_Failure()
        {
            //invalid objectId response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = "/vmrest/callhandlertemplates/junk"
            });

            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.AddCallHandlerTemplate(_mockServer, "test", "test", "", "test", null, out oTemplate);

            Assert.IsFalse(res.Success, "AddCallHandlerTemplate that produces invalid new ObjectId did not fail");
        }
        /// <summary>
        /// Helper method to create a temporary handler template for use in these tests
        /// </summary>
        private static WebCallResult CreateTemplateHandler()
        {
            //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);
            }

            CallHandlerTemplate oTemplate = oTemplates[0];

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

            return(CallHandlerTemplate.AddCallHandlerTemplate(_connectionServer, strName, oTemplate.MediaSwitchObjectId,
                                                              oTemplate.RecipientDistributionListObjectId,
                                                              oTemplate.RecipientSubscriberObjectId, null,
                                                              out _tempHandlerTemplate));
        }