Esempio n. 1
0
        public void GetCallHandlerTemplate_EmptyObjectId_Failure()
        {
            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.GetCallHandlerTemplate(out oTemplate, _mockServer, "", "");

            Assert.IsFalse(res.Success, "GetCallHandlerTemplate with empty objectId and name did not fail");
        }
Esempio n. 2
0
        public void GetCallHandlerTemplate_NullConnectionServer_Failure()
        {
            CallHandlerTemplate oTemplate;
            var res = CallHandlerTemplate.GetCallHandlerTemplate(out oTemplate, null, "objectid", "displayname");

            Assert.IsFalse(res.Success, "GetCallHandlerTemplate with null ConnectionServerRest did not fail");
        }
        public void StaticCallFailures__GetCallHandlerTemplate()
        {
            CallHandlerTemplate oTemplate;

            var res = CallHandlerTemplate.GetCallHandlerTemplate(out oTemplate, _connectionServer, "objectId", "");

            Assert.IsFalse(res.Success, "GetCallHandlerTemplate with invalid objectId did not fail");

            res = CallHandlerTemplate.GetCallHandlerTemplate(out oTemplate, _connectionServer, "", "_bogus_");
            Assert.IsFalse(res.Success, "GetCallHandlerTemplate with invalid name did not fail");
        }
        public void CallHandlerTemplate_FetchTest()
        {
            List <CallHandlerTemplate> oTemplates;

            WebCallResult res = CallHandlerTemplate.GetCallHandlerTemplates(null, out oTemplates);

            Assert.IsFalse(res.Success, "Null ConnectionServerRest parameter should fail");

            res = CallHandlerTemplate.GetCallHandlerTemplates(_connectionServer, out oTemplates, 1, 10, null);
            Assert.IsTrue(res.Success, "Failed to get call handler templates");
            Assert.IsNotNull(oTemplates, "Null call handler template returned");
            Assert.IsTrue(oTemplates.Count > 0, "Empty list of templates returned");

            //exercise the toString method
            Console.WriteLine(oTemplates[0].ToString());
            Console.WriteLine(oTemplates[0].DumpAllProps());

            res = oTemplates[0].RefetchUserTemplateData();
            Assert.IsTrue(res.Success, "Failed refetching template data:" + res);

            //exercise the NEW create methods
            CallHandlerTemplate oNewTemplate;

            try
            {
                oNewTemplate = new CallHandlerTemplate(_connectionServer, oTemplates[0].ObjectId);
                Console.WriteLine(oNewTemplate);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to get call handler template via NEW by objectId:" + ex);
            }

            try
            {
                oNewTemplate = new CallHandlerTemplate(_connectionServer, "", oTemplates[0].DisplayName);
                Console.WriteLine(oNewTemplate);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to get call handler template via NEW by displayName:" + ex);
            }

            try
            {
                oNewTemplate = new CallHandlerTemplate(_connectionServer, "");
                Console.WriteLine(oNewTemplate);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to create empty call handler template via NEW:" + ex);
            }

            //exercise the static methods
            res = CallHandlerTemplate.GetCallHandlerTemplate(out oNewTemplate, _connectionServer);
            Assert.IsFalse(res.Success, "Static call to get call handler template did not fail with empty objectid and name");

            res = CallHandlerTemplate.GetCallHandlerTemplate(out oNewTemplate, null);
            Assert.IsFalse(res.Success, "Static call to get call handler template did not fail with null ConnectionServer");

            res = CallHandlerTemplate.GetCallHandlerTemplate(out oNewTemplate, _connectionServer, oTemplates[0].ObjectId);
            Assert.IsTrue(res.Success, "Failed to get call handler via static call using ObjectID:" + res);

            res = CallHandlerTemplate.GetCallHandlerTemplate(out oNewTemplate, _connectionServer, "", oTemplates[0].DisplayName);
            Assert.IsTrue(res.Success, "Failed to get call handler via static call using DisplayName:" + res);

            res = CallHandlerTemplate.GetCallHandlerTemplate(out oNewTemplate, _connectionServer, "", "bogus");
            Assert.IsFalse(res.Success, "Call to get call handler via static call using invalid DisplayName did not fail.");

            res = CallHandlerTemplate.GetCallHandlerTemplates(_connectionServer, out oTemplates, 1, 2, "query=(ObjectId is bogus)");
            Assert.IsTrue(res.Success, "fetching Templates with invalid query should not fail:" + res);
            Assert.IsTrue(oTemplates.Count == 0, "Invalid query string should return an empty COS list:" + oTemplates.Count);
        }