Beispiel #1
0
        public void GetConferenceRequestTest()
        {
            try
            {
                ConferencesRequester confRequester = new ConferencesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       confRequesterType  = typeof(ConferencesRequester);
                MethodInfo persyUrlMethodInfo = confRequesterType.GetMethod("setPersyUrl",
                                                                            BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                            null,
                                                                            new Type[] { typeof(System.String) },
                                                                            null);
                persyUrlMethodInfo.Invoke(confRequester, new Object[] { "http://GetConferenceRequestTest:3000" });

                WebRequest.RegisterPrefix("http://GetConferenceRequestTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe46ff1274e283f7e3ac1df0072ab39\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"conferenceId\" : \"CFbbe46ff1274e283f7e3ac1df0072ab39\", \"accountId\" : \"AC142c48f2ee663e214c19ea459516068c\", \"alias\" : \"API\", \"playBeep\": \"always\", \"record\": false, \"waitUrl\": null, \"statusCallbackUrl\": null, \"status\" : \"empty\", \"subresourceUris\" : { \"participants\" : \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe46ff1274e283f7e3ac1df0072ab39/Participants\", \"recordings\" : \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe46ff1274e283f7e3ac1df0072ab39/Recordings\"}}");

                Conference conference = confRequester.getConference("CFbbe46ff1274e283f7e3ac1df0072ab39");

                Assert.IsNotNull(conference);
                Assert.AreEqual(conference.getUri, "/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe46ff1274e283f7e3ac1df0072ab39");
                Assert.AreEqual(conference.getSubresourceUris.Count, 2);
                Assert.AreEqual(conference.getRevision, 1);
                Assert.IsNotNull(conference.getDateCreated);
                Assert.IsNotNull(conference.getDateUpdated);
                Assert.AreEqual(conference.getStatus, EConferenceStatus.Empty);
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Beispiel #2
0
        public void DeleteParticipantTest()
        {
            try
            {
                ConferencesRequester confRequester = new ConferencesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       confRequesterType  = typeof(ConferencesRequester);
                MethodInfo persyUrlMethodInfo = confRequesterType.GetMethod("setPersyUrl",
                                                                            BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                            null,
                                                                            new Type[] { typeof(System.String) },
                                                                            null);
                persyUrlMethodInfo.Invoke(confRequester, new Object[] { "http://DeleteParticipantTest:3000" });

                WebRequest.RegisterPrefix("http://DeleteParticipantTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK);

                confRequester.deleteParticipant("CFbbe46ff1274e283f7e3ac1df0072ab39", "CA386025c9bf5d6052a1d1ea42b4d16662");
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Beispiel #3
0
        public void MakeAFailedSmsRequestWithNotRequiredFieldsTest()
        {
            try
            {
                MessagesRequester messagesRequester = new MessagesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       messagesRequesterType = typeof(MessagesRequester);
                MethodInfo persyUrlMethodInfo    = messagesRequesterType.GetMethod("setPersyUrl",
                                                                                   BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                                   null,
                                                                                   new Type[] { typeof(System.String) },
                                                                                   null);
                persyUrlMethodInfo.Invoke(messagesRequester, new Object[] { "http://MakeAInitialSmsRequestTest:3000" });

                WebRequest.RegisterPrefix("http://MakeAInitialSmsRequestTest:3000", new TestWebRequestCreate());

                string to   = "";
                string from = "+12248806205";
                string text = "Hello World";

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Messages/MM16ac1bcbd6f4895c89a798571e89e1e715892924\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"messageId\" : \"MM16ac1bcbd6f4895c89a798571e89e1e715892924\", \"accountId\" : \"AC736ca2078721a9a41fb47f07bf40d9e21cb304da\", \"from\" : \"" + from + "\", \"to\" : \"" + to + "\", \"text\" : \"" + text + "\", \"direction\" : \"outbound\", \"status\" : \"sending\"}");
                Message msg = messagesRequester.create(from, to, text);
            }
            catch (PersyException /* pe */)
            {
                Assert.IsTrue(true);
                return;
            }
            // if no exception, it fails
            Assert.Fail();
        }
Beispiel #4
0
        public void GetParticipantRequestTest()
        {
            try
            {
                ConferencesRequester confRequester = new ConferencesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       confRequesterType  = typeof(ConferencesRequester);
                MethodInfo persyUrlMethodInfo = confRequesterType.GetMethod("setPersyUrl",
                                                                            BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                            null,
                                                                            new Type[] { typeof(System.String) },
                                                                            null);
                persyUrlMethodInfo.Invoke(confRequester, new Object[] { "http://GetParticipantRequestTest:3000" });

                WebRequest.RegisterPrefix("http://GetParticipantRequestTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe4632a3c49700934481addd5ce1659/Participants/CA386025c9bf5d6052a1d1ea42b4d16662\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"callId\" : \"CA386025c9bf5d6052a1d1ea42b4d16662\", \"conferenceId\" : \"CFbbe4632a3c49700934481addd5ce1659\", \"accountId\" : \"AC142c48f2ee663e214c19ea459516068c\", \"talk\" : true, \"listen\" : true, \"startConfOnEnter\" : false}");

                Participant participant = confRequester.getParticipant("CFbbe4632a3c49700934481addd5ce1659", "CA386025c9bf5d6052a1d1ea42b4d16662");

                Assert.IsNotNull(participant);
                Assert.AreEqual(participant.getUri, "/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe4632a3c49700934481addd5ce1659/Participants/CA386025c9bf5d6052a1d1ea42b4d16662");
                Assert.AreEqual(participant.getTalk, EBool.True);
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Beispiel #5
0
        public void CreateIncomingNumberWithRequestIdTest()
        {
            try
            {
                IncomingPhoneNumbersRequester requester = new IncomingPhoneNumbersRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://CreateIncomingTest:3000");
                }

                WebRequest.RegisterPrefix("http://CreateIncomingTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{ \"phoneNumber\" : \"+13122290330\", \"alias\" : \"incoming number 1\", \"revision\" : 2, \"dateCreated\" : \"Fri, 11 Nov 2016 13:42:25 GMT\", \"dateUpdated\" : \"Wed, 01 Feb 2017 19:33:00 GMT\", \"phoneNumberId\" : \"PN3816047eda7b012ea2cf6d5e0697a2474363dcd6\", \"region\" : \"Illinois\", \"country\" : \"US\", \"voiceEnabled\" : true, \"smsEnabled\" : true, \"applicationId\" : \"APbd38defccbf9a1db844551aa8ae0531a876bc84b\", \"uri\" : \"/Accounts/AC907d7e328b3a5b402fa908857e047a243a8949b1/IncomingPhoneNumbers/PN3816047eda7b012ea2cf6d5e0697a2474363dcd6\", \"accountId\" : \"AC907d7e328b3a5b402fa908857e047a243a8949b1\"} ");
                IncomingPhoneNumberOptions options = new IncomingPhoneNumberOptions();
                options.setAlias("incoming number 1");
                options.setApplicationId("APbd38defccbf9a1db844551aa8ae0531a876bc84b");
                options.setRequestId("RQ1234567890123456789012345678901234567890");
                IncomingPhoneNumber num = requester.create("+13122290330", options);

                Assert.IsNotNull(num);
                Assert.AreEqual(num.getAlias, "incoming number 1");
                Assert.AreEqual(num.getPhoneNumber, "+13122290330");
                Assert.IsNotNull(num.getPhoneNumberId);
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void QueueCreateWithOptionsTest()
        {
            QueuesRequester queuesRequester = new QueuesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

            Type      type      = typeof(APIRequester);
            FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);

            if (fieldInfo != null)
            {
                fieldInfo.SetValue(queuesRequester, "http://QueueCreateWithOptions:3000");
            }

            WebRequest.RegisterPrefix("http://QueueCreateWithOptions:3000", new TestWebRequestCreate());
            TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                         "{\"uri\": \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Queues/QU5ef8732a3c49700934481addd5ce1659\", \"dateCreated\": \"Mon, 11 Aug 2014 22:00:14 GMT\", \"dateUpdated\": \"Mon, 11 Aug 2014 22:00:14 GMT\", \"revision\": 1, \"queueId\": \"QU5ef8732a3c49700934481addd5ce1659\", \"alias\": \"newQueue\", \"currentSize\": 0, \"maxSize\": 1000, \"averageWaitTime\": 0}");

            QueueOptions queueOptions = new QueueOptions();

            queueOptions.setAlias("newQueue");
            queueOptions.setMaxSize(1000);
            Queue queue = queuesRequester.create(queueOptions);

            Assert.IsNotNull(queue);
            Assert.AreEqual(queue.getUri, "/Accounts/AC142c48f2ee663e214c19ea459516068c/Queues/QU5ef8732a3c49700934481addd5ce1659");
            Assert.AreEqual(queue.getQueueId, "QU5ef8732a3c49700934481addd5ce1659");
        }
        public void GetCallTest()
        {
            try
            {
                CallsRequester callsRequester = new CallsRequester("ACabe7063197551fe51671f9ac3a9708e9dad51c4d", "204c15aae7a486c42776aea4dbafe8c68a773071", "ACabe7063197551fe51671f9ac3a9708e9dad51c4d");

                Type       callsRequesterType     = typeof(CallsRequester);
                MethodInfo freeClimbUrlMethodInfo = callsRequesterType.GetMethod("SetFreeClimbUrl",
                                                                                 BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                                 null,
                                                                                 new Type[] { typeof(System.String) },
                                                                                 null);
                freeClimbUrlMethodInfo.Invoke(callsRequester, new Object[] { "http://GetCallTest:3000" });

                WebRequest.RegisterPrefix("http://GetCallTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b\", \"revision\" : 1, \"dateCreated\" : \"Mon, 28 Mar 2016 19:58:21 GMT\", \"dateUpdated\" : \"Mon, 28 Mar 2016 19:58:21 GMT\", \"callId\" : \"CAfe92a5efbaf90f04bbec946a0d74dad520dd883b\", \"parentCallId\" : null, \"accountId\" : \"ACabe7063197551fe51671f9ac3a9708e9dad51c4d\", \"from\" : \"847655770\", \"to\" : \"+11112223333\", \"phoneNumberId\" : null, \"status\" : \"completed\", \"startTime\" : \"Mon, 28 Mar 2016 19:58:21 GMT\", \"endTime\" : \"Mon, 28 Mar 2016 19:58:30 GMT\", \"duration\" : 9, \"direction\" : \"inbound\", \"answeredBy\" : null, \"callerName\" : null, \"subresourceUris\" : {\"notifications\" : \"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b/Notifications\", \"recordings\" : \"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b/Recordings\"}}");

                Call call = callsRequester.get("CAfe92a5efbaf90f04bbec946a0d74dad520dd883b");

                Assert.IsNotNull(call);
                Assert.AreEqual(call.getCallId, "CAfe92a5efbaf90f04bbec946a0d74dad520dd883b");
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void UpdateAccountTest()
        {
            try
            {
                AccountsRequester accountRequester = new AccountsRequester("AC66c1bebe590a6389f60efa0ee9ce74d44bc29747", "e1b6406c8db5369912234f006ce1cbaa267561da");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(accountRequester, "http://CreateAccountTest:3000");
                }

                WebRequest.RegisterPrefix("http://CreateAccountTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747\", \"revision\" : 3, \"dateCreated\" : \"Mon, 30 Jan 2017 16:30:49 GMT\", \"dateUpdated\" : \"Mon, 30 Jan 2017 17:31:47 GMT\", \"accountId\" : \"AC66c1bebe590a6389f60efa0ee9ce74d44bc29747\", \"authToken\" : \"e1b6406c8db5369912234f006ce1cbaa267561da\", \"alias\" : \"new test account 1\", \"label\" : \"test account 1 label\", \"type\" : \"trial\", \"status\" : \"active\", \"subresourceUris\" : {\"applications\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Applications\", \"calls\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Calls\", \"availablePhoneNumbers\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/AvailablePhoneNumbers\", \"conferences\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Conferences\", \"incomingPhoneNumbers\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/IncomingPhoneNumbers\", \"logs\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Logs\", \"callingNumbers\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/CallingNumbers\", \"recordings\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Recordings\", \"queues\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Queues\"}}");
                AccountOptions options = new AccountOptions();
                options.setAlias("new test account 1");
                options.setLabel("test account 1 label");
                Account account = accountRequester.update("AC66c1bebe590a6389f60efa0ee9ce74d44bc29747");

                Assert.IsNotNull(account);
                Assert.AreEqual(account.getAlias, "new test account 1");
                Assert.AreEqual(account.getLabel, "test account 1 label");
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Beispiel #9
0
        public void CreateCallingNumberWithRequestIdTest()
        {
            try
            {
                CallingNumbersRequester requester = new CallingNumbersRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://CreateCallingTest:3000");
                }

                WebRequest.RegisterPrefix("http://CreateCallingTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{ \"phoneNumber\" : \"+13033447438\", \"alias\" : \"Calling number 1\", \"revision\" : 1, \"dateCreated\" : \"Wed, 01 Feb 2017 17:33:27 GMT\", \"dateUpdated\" : \"Wed, 01 Feb 2017 17:33:27 GMT\", \"callingNumberId\" : \"PN7bbef986a434fd30ba006551ed6cc507403b5e87\", \"uri\" : \"/Accounts/AC907d7e328b3a5b402fa908857e047a243a8949b1/CallingNumbers/PN7bbef986a434fd30ba006551ed6cc507403b5e87\", \"accountId\" : \"AC907d7e328b3a5b402fa908857e047a243a8949b1\"}");
                CallingNumberOptions options = new CallingNumberOptions();
                options.setAlias("Calling number 1");
                options.setRequestId("RQ1234567890123456789012345678901234567890");

                CallingNumber num = requester.create("+13033447438", options);

                Assert.IsNotNull(num);
                Assert.AreEqual(num.getAlias, "Calling number 1");
                Assert.AreEqual(num.getPhoneNumber, "+13033447438");
                Assert.IsNotNull(num.getCallingNumberId);
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void GetRecordingStreamTest()
        {
            try
            {
                RecordingsRequester recordingsRequester = new RecordingsRequester("ACabe7063197551fe51671f9ac3a9708e9dad51c4d", "204c15aae7a486c42776aea4dbafe8c68a773071", "ACabe7063197551fe51671f9ac3a9708e9dad51c4d");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(recordingsRequester, "http://GetRecordingStreamTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetRecordingStreamTest:3000", new TestWebRequestCreate());

                byte[] rawWav = { 0x52, 0x49, 0x46, 0x46, 0x84, 0x0a, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45, 0x66, 0x6d, 0x74, 0x20, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x40, 0x1f, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x60, 0x0a, 0x00, 0x00, 0xf8, 0xff, 0xf0, 0xff, 0xf1, 0xff, 0xf5, 0xff, 0xfc, 0xff, 0xf3, 0xff, 0xf6, 0xff, 0xe3, 0xff, 0xea, 0xff, 0xf0, 0xff, 0xf7, 0xff, 0xf9, 0xff, 0xf7, 0xff, 0xf8, 0xff, 0xf9, 0xff, 0xf7, 0xff, 0xf1, 0xff, 0xef, 0xff, 0xe8, 0xff, 0xf8, 0xff, 0x01, 0x00, 0x07, 0x00, 0x11, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x01, 0x00, 0xf7, 0xff, 0xf9, 0xff, 0xee, 0xff, 0xf1, 0xff, 0xf8, 0xff, 0x08, 0x00, 0x08, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xf9, 0xff, 0x00, 0x00, 0x07, 0x00, 0x0a, 0x00, 0x05, 0x00, 0x03, 0x00, 0x06, 0x00, 0x09, 0x00, 0xff, 0xff, 0x01, 0x00, 0x07, 0x00, 0x09, 0x00, 0xff, 0xff, 0xf9, 0xff, 0xef, 0xff, 0xf9, 0xff, 0xf8, 0xff, 0xff, 0xff, 0x02, 0x00, 0xf5, 0xff, 0x02, 0x00, 0xf8, 0xff, 0xf0, 0xff, 0xe8, 0xff, 0xe7, 0xff, 0xf8, 0xff, 0x01, 0x00, 0xf8, 0xff, 0xef, 0xff, 0xf1, 0xff, 0xe7, 0xff, 0xe0, 0xff, 0xd9, 0xff, 0xd7, 0xff, 0xd9, 0xff, 0xd8, 0xff, 0xe6, 0xff, 0xf2, 0xff, 0xef, 0xff, 0xf8, 0xff, 0x09, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x13, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x0e, 0x00, 0x10, 0x00, 0x11, 0x00, 0x10, 0x00, 0x1f, 0x00, 0x22, 0x00, 0x15, 0x00, 0x13, 0x00, 0xfe, 0xff, 0x02, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0xf9, 0xff, 0xf5, 0xff, 0xf3, 0xff, 0xe5, 0xff, 0xf4, 0xff, 0xf5, 0xff, 0xf9, 0xff, 0xf8, 0xff, 0xf7, 0xff, 0x0a, 0x00, 0x07, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x09, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x12, 0x00, 0x0e, 0x00, 0xf2, 0xff, 0xdf, 0xff, 0xbf, 0xff, 0xda, 0xff, 0xe6, 0xff, 0xf2, 0xff, 0x07, 0x00, 0x17, 0x00, 0x12, 0x00, 0x16, 0x00, 0x1a, 0x00, 0x0f, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xda, 0xff, 0xd6, 0xff, 0xda, 0xff, 0xdd, 0xff, 0xf3, 0xff, 0xd5, 0xff, 0x13, 0x00, 0x45, 0x00, 0x42, 0x00, 0x48, 0x00, 0x47, 0x00, 0x31, 0x00, 0x27, 0x00, 0x11, 0x00, 0x18, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x48, 0x00, 0x37, 0x00, 0x1a, 0x00, 0xfe, 0xff, 0xda, 0xff, 0x9e, 0xff, 0x89, 0xff, 0x87, 0xff, 0x8a, 0xff, 0x9e, 0xff, 0xb9, 0xff, 0xb0, 0xff, 0xcf, 0xff, 0xea, 0xff, 0xce, 0xff, 0xda, 0xff, 0xce, 0xff, 0xc2, 0xff, 0xd6, 0xff, 0xf2, 0xff, 0xef, 0xff, 0x0f, 0x00, 0x33, 0x00, 0x4d, 0x00, 0x52, 0x00, 0x37, 0x00, 0x27, 0x00, 0x1a, 0x00, 0xef, 0xff, 0xd0, 0xff, 0x09, 0x00, 0x1e, 0x00, 0x62, 0x00, 0xa3, 0x00, 0xe4, 0x00, 0x14, 0x01, 0x04, 0x01, 0x15, 0x01, 0x23, 0x01, 0x14, 0x01, 0xe4, 0x00, 0xe3, 0x00, 0xc7, 0x00, 0x81, 0x00, 0x42, 0x00, 0xf6, 0xff, 0xa2, 0xff, 0x4a, 0xff, 0xff, 0xfe, 0xb8, 0xfe, 0x79, 0xfe, 0x4f, 0xfe, 0xf9, 0xfd, 0xef, 0xfd, 0xb8, 0xfd, 0xb2, 0xfd, 0x54, 0xfd, 0xf6, 0xfc, 0x52, 0xfd, 0x95, 0xfd, 0x14, 0xfe, 0xdb, 0xfe, 0x6d, 0xff, 0x68, 0x00, 0x53, 0x01, 0xad, 0x01, 0x0c, 0x02, 0x6a, 0x02, 0x70, 0x02, 0x47, 0x02, 0x90, 0x02, 0x69, 0x02, 0x8e, 0x02, 0xcb, 0x02, 0xcd, 0x02, 0xca, 0x02, 0xce, 0x02, 0x4b, 0x02, 0xac, 0x02, 0x9d, 0x03, 0x1b, 0x04, 0x5c, 0x04, 0x1d, 0x05, 0xdb, 0x04, 0x5d, 0x04, 0x1c, 0x04, 0xcb, 0x01, 0xd1, 0xff, 0x54, 0xfd, 0xe3, 0xfa, 0xa5, 0xf8, 0xc4, 0xf6, 0xc4, 0xf4, 0x44, 0xf3, 0x44, 0xf3, 0x43, 0xf2, 0xc6, 0xf2, 0x42, 0xf5, 0x46, 0xf6, 0x63, 0xf9, 0x24, 0xfc, 0xbc, 0xfe, 0x74, 0x01, 0x5b, 0x04, 0x1f, 0x06, 0x58, 0x07, 0x40, 0x08, 0x38, 0x09, 0x3f, 0x0a, 0xbb, 0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, 0x93, 0xfd, 0xb3, 0xfd, 0x27, 0xfb, 0x60, 0xfc, 0x28, 0xfc, 0xa1, 0xfb, 0xf5, 0xfc, 0x44, 0xf8, 0x44, 0xf8, 0x54, 0xfd, 0xa4, 0xfb, 0x63, 0xfb, 0x02, 0x00, 0xba, 0x0b, 0xfe, 0x17, 0xf9, 0x10, 0xbf, 0x0b, 0xfa, 0x16, 0x3e, 0x0a, 0xa2, 0xfb, 0x65, 0xf9, 0x03, 0xed, 0x05, 0xef, 0xc4, 0xf0, 0x03, 0xea, 0xa6, 0xf8, 0x52, 0x01, 0xd5, 0xfd, 0xdb, 0x06, 0x3d, 0x09, 0x9c, 0x04, 0x1d, 0x04, 0xf1, 0xfd, 0x68, 0xfc, 0xe0, 0xfb, 0xc7, 0xf6, 0x62, 0xfa, 0x35, 0xfd, 0xb4, 0xfd, 0x9d, 0x03, 0xda, 0x03, 0x5e, 0x07, 0xb9, 0x0a, 0xe0, 0x06, 0x18, 0x07, 0xa0, 0x05, 0x91, 0x00, 0xa9, 0xff, 0x14, 0xfe };

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             rawWav);

                MemoryStream memoryStream = new MemoryStream();
                using (BinaryReader reader = new BinaryReader(recordingsRequester.stream("REb1eecfce410141ad1749c0fc84dfbb6fc4c2a810")))
                {
                    reader.BaseStream.CopyTo(memoryStream);
                }

                byte[] byteResponse = memoryStream.ToArray();

                Assert.IsTrue(rawWav.SequenceEqual(byteResponse));
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void MakeUpdateRequestTest()
        {
            try
            {
                CallsRequester callsRequester = new CallsRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       callsRequesterType     = typeof(CallsRequester);
                MethodInfo freeClimbUrlMethodInfo = callsRequesterType.GetMethod("SetFreeClimbUrl",
                                                                                 BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                                 null,
                                                                                 new Type[] { typeof(System.String) },
                                                                                 null);
                freeClimbUrlMethodInfo.Invoke(callsRequester, new Object[] { "http://MakeUpdateRequestTest:3000" });

                WebRequest.RegisterPrefix("http://MakeUpdateRequestTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Calls/CA16ac1bcbd6f4895c89a798571e89e1e715892924\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"callId\" : \"CA16ac1bcbd6f4895c89a798571e89e1e715892924\", \"parentCallId\" : null, \"accountId\" : \"AC736ca2078721a9a41fb47f07bf40d9e21cb304da\", \"from\" : \"+12248806205\", \"to\" : \"+18475978014\", \"phoneNumberId\" : \"PN1311218371073288ff9c0434698753f98ea4228a\", \"status\" : \"canceled\", \"startTime\" : null, \"endTime\" : null, \"duration\" : 0, \"direction\" : \"outboundAPI\", \"answeredBy\" : null, \"callerName\" : null, \"subresourceUris\" : {\"notifications\" : \"/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Calls/CA16ac1bcbd6f4895c89a798571e89e1e715892924/Notifications\", \"recordings\" : \"/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Calls/CA16ac1bcbd6f4895c89a798571e89e1e715892924/Recordings\"}}");

                CallTermOptions callOptions = new CallTermOptions();
                callOptions.setStatus(ECallStatus.Canceled);
                callsRequester.update("CA16ac1bcbd6f4895c89a798571e89e1e715892924", callOptions);
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void GetRecordingMetaTest()
        {
            try
            {
                RecordingsRequester recordingsRequester = new RecordingsRequester("ACabe7063197551fe51671f9ac3a9708e9dad51c4d", "204c15aae7a486c42776aea4dbafe8c68a773071", "ACabe7063197551fe51671f9ac3a9708e9dad51c4d");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(recordingsRequester, "http://GetRecordingMetaTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetRecordingMetaTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Recordings/REb1eecfce410141ad1749c0fc84dfbb6fc4c2a810\", \"revision\" : 1, \"dateCreated\" : \"Mon, 27 Jun 2016 17:53:55 GMT\", \"dateUpdated\" : \"Mon, 27 Jun 2016 17:53:55 GMT\", \"recordingId\" : \"REb1eecfce410141ad1749c0fc84dfbb6fc4c2a810\", \"accountId\" : \"ACabe7063197551fe51671f9ac3a9708e9dad51c4d\", \"conferenceId\" : \"CF3cb8a52f461bcf64cbd3111d9492c3f61943eef9\", \"duration\" : 9}");

                Recording recording = recordingsRequester.getMetaByRecordingId("REb1eecfce410141ad1749c0fc84dfbb6fc4c2a810");

                Assert.IsNotNull(recording);
                Assert.AreEqual(recording.getRecordingId, "REb1eecfce410141ad1749c0fc84dfbb6fc4c2a810");
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void GetApplicationTest()
        {
            try
            {
                ApplicationsRequester requester = new ApplicationsRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetApplicationTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetApplicationTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Applications/APe4238465edbc017acfbddfe80c66594ef6c72669\", \"revision\" : 1, \"dateCreated\" : \"Mon, 30 Jan 2017 23:35:00 GMT\", \"dateUpdated\" : \"Mon, 30 Jan 2017 23:35:00 GMT\", \"applicationId\" : \"APe4238465edbc017acfbddfe80c66594ef6c72669\", \"accountId\" : \"AC66c1bebe590a6389f60efa0ee9ce74d44bc29747\", \"alias\" : \"test application 1\", \"voiceUrl\" : \"http://CreateApplicationTest:3000/VoiceUrl\", \"callConnectUrl\" : \"http://CreateApplicationTest:3000/CCUrl\", \"voiceFallbackUrl\" : \"http://CreateApplicationTest:3000/VoiceUrl\", \"statusCallbackUrl\" : \"http://CreateApplicationTest:3000/Status\",  \"smsUrl\" : \"http://CreateApplicationTest:3000/SmsUrl\", \"smsFallbackUrl\" : \"http://CreateApplicationTest:3000/SmsUrl2\"}");

                Application app = requester.get("APe4238465edbc017acfbddfe80c66594ef6c72669");

                Assert.IsNotNull(app);
                Assert.AreEqual(app.getApplicationId, "APe4238465edbc017acfbddfe80c66594ef6c72669");
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void GetAccountTest()
        {
            try
            {
                AccountsRequester accountRequester = new AccountsRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(accountRequester, "http://GetAccountTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetAccountTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747\", \"revision\" : 3, \"dateCreated\" : \"Mon, 30 Jan 2017 16:30:49 GMT\", \"dateUpdated\" : \"Mon, 30 Jan 2017 17:31:47 GMT\", \"accountId\" : \"AC66c1bebe590a6389f60efa0ee9ce74d44bc29747\", \"authToken\" : \"e1b6406c8db5369912234f006ce1cbaa267561da\", \"alias\" : \"new test account 1\", \"label\" : \"test account 1 label\", \"type\" : \"trial\", \"status\" : \"active\", \"subresourceUris\" : {\"applications\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Applications\", \"calls\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Calls\", \"availablePhoneNumbers\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/AvailablePhoneNumbers\", \"conferences\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Conferences\", \"incomingPhoneNumbers\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/IncomingPhoneNumbers\", \"logs\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Logs\", \"callingNumbers\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/CallingNumbers\", \"recordings\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Recordings\", \"queues\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Queues\"}}");

                Account account = accountRequester.get("AC66c1bebe590a6389f60efa0ee9ce74d44bc29747");

                Assert.IsNotNull(account);
                Assert.AreEqual(account.getAccountId, "AC66c1bebe590a6389f60efa0ee9ce74d44bc29747");
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Beispiel #15
0
        public void GetIncomingNumberTest()
        {
            try
            {
                IncomingPhoneNumbersRequester requester = new IncomingPhoneNumbersRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetIncomingTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetIncomingTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"phoneNumber\" : \"+13126516046\", \"alias\" : \"312-651-6046\", \"revision\" : 2, \"dateCreated\" : \"Fri, 11 Nov 2016 13:42:22 GMT\", \"dateUpdated\" : \"Thu, 08 Dec 2016 20:41:18 GMT\", \"phoneNumberId\" : \"PN5fdc25a5db02d03aa1da1f85f18d6bfa6e45a701\", \"region\" : \"Illinois\", \"country\" : \"US\", \"voiceEnabled\" : true, \"smsEnabled\" : true, \"applicationId\" : \"APbd38defccbf9a1db844551aa8ae0531a876bc84b\", \"uri\" : \"/Accounts/AC907d7e328b3a5b402fa908857e047a243a8949b1/IncomingPhoneNumbers/PN5fdc25a5db02d03aa1da1f85f18d6bfa6e45a701\", \"accountId\" : \"AC907d7e328b3a5b402fa908857e047a243a8949b1\"}");


                IncomingPhoneNumber num = requester.get("PN5fdc25a5db02d03aa1da1f85f18d6bfa6e45a701");

                Assert.IsNotNull(num);
                Assert.AreEqual(num.getPhoneNumberId, "PN5fdc25a5db02d03aa1da1f85f18d6bfa6e45a701");
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Beispiel #16
0
        public void GetLogListTest()
        {
            try
            {
                LogsRequester requester = new LogsRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetLogListTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetLogListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":0,\"end\":1,\"page\":0,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Applications&cursor=492dc883a811bd0204204ea9047122f93a2788a2\", \"logs\" : [{\"hostname\":\"spv07vcs10\",\"subsystem\":\"vcsserver\",\"timestamp\":1485450179059490,\"scope\":\"public\",\"level\":\"info\",\"accountId\":\"AC907d7e328b3a5b402fa908857e047a243a8949b1\",\"requestId\":\"RQ5c8c6d7df5d19096eb71ce516a39ade6aa1b0d4f\",\"callId\":\"CA5c8c6d7df5d19096eb71ce516a39ade6aa1b0d4f\",\"message\":\"Customer Response 200 : POST http://172.29.11.10/FreeClimbSurvey/FreeClimbSurvey/CallStatus\",\"metadata\":{}},{\"hostname\":\"spv07vcs10\",\"subsystem\":\"vcsserver\",\"timestamp\":1485450178755768,\"scope\":\"public\",\"level\":\"info\",\"accountId\":\"AC907d7e328b3a5b402fa908857e047a243a8949b1\",\"requestId\":\"RQ5c8c6d7df5d19096eb71ce516a39ade6aa1b0d4f\",\"callId\":\"CA5c8c6d7df5d19096eb71ce516a39ade6aa1b0d4f\",\"message\":\"Customer Request : POST http://172.29.11.10/FreeClimbSurvey/FreeClimbSurvey/CallStatus\",\"metadata\":{\"requestBody\":{\"accountId\":\"AC907d7e328b3a5b402fa908857e047a243a8949b1\",\"callDuration\":7,\"callId\":\"CA5c8c6d7df5d19096eb71ce516a39ade6aa1b0d4f\",\"callStatus\":\"completed\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13038472859\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"callStatus\",\"to\":\"+13124881429\"},\"requestHeaders\":{\"X-Pulse-Signature\":\"a80fc8c501a7b46a1864d16572882ff86712317a\",\"X-Pulse-Timestamp\":1485450178,\"url\":\"http://172.29.11.10/FreeClimbSurvey/FreeClimbSurvey/CallStatus\"}}}]}");

                LogList logList = requester.get();

                Assert.IsNotNull(logList);

                Assert.AreEqual(logList.getLocalSize, 2);
                Assert.AreEqual((logList.export()).Count, 2);

                Log log = logList.get(0) as Log;

                Assert.IsNotNull(log);
                Assert.AreEqual(log.getCallId, "CA5c8c6d7df5d19096eb71ce516a39ade6aa1b0d4f");
                Assert.AreEqual(log.getRequestId, "RQ5c8c6d7df5d19096eb71ce516a39ade6aa1b0d4f");

                type      = typeof(APIRequester);
                fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(logList, "http://GetLogListTest:3000");
                }

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":2,\"end\":2,\"page\":1,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":null, \"logs\" : [ {\"hostname\":\"spv07vcs10\",\"subsystem\":\"vcsserver\",\"timestamp\":1485450178603416,\"scope\":\"public\",\"level\":\"info\",\"accountId\":\"AC907d7e328b3a5b402fa908857e047a243a8949b1\",\"requestId\":null,\"callId\":\"CA5c8c6d7df5d19096eb71ce516a39ade6aa1b0d4f\",\"message\":\"Customer Response 200 : POST http://172.29.11.10/FreeClimbSurvey/FreeClimbSurvey/NextQuestion\",\"metadata\":[{\"GetSpeech\":{\"actionUrl\":\"http://172.29.11.10/FreeClimbSurvey/FreeClimbSurvey/HandleQuestionResponse\",\"grammarFile\":\"http://172.29.11.10/FreeClimbSurvey/Grammars/969d88d2-8edb-4ad9-8436-aa0c4d268f56.grxml\",\"grammarRule\":\"Choices\",\"grammarType\":\"URL\",\"noInputTimeoutMs\":4000,\"prompts\":[{\"Say\":{\"text\":\"what is your favorite color\"}}],\"recognitionTimeoutMs\":5000}}]}]}");

                logList.loadNextPage();

                Assert.IsNotNull(logList);

                Assert.AreEqual(logList.getLocalSize, 3);
                Assert.AreEqual((logList.export()).Count, 3);

                log = logList.get(2) as Log;
                Assert.IsNotNull(log);
                Assert.AreEqual(log.getCallId, "CA5c8c6d7df5d19096eb71ce516a39ade6aa1b0d4f");
                Assert.IsNull(log.getRequestId);
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Beispiel #17
0
        public void GetAvailableListTest()
        {
            try
            {
                AvailablePhoneNumbersRequester requester = new AvailablePhoneNumbersRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetAvailableListTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetAvailableListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":0,\"end\":1,\"page\":0,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":\"/AvailablePhoneNumbers&cursor=492dc883a811bd0204204ea9047122f93a2788a2\", \"availablePhoneNumbers\" : [{\"phoneNumber\" : \"+13122290330\", \"alias\" : \"312-229-0330\", \"revision\" : 1, \"dateCreated\" : \"Fri, 11 Nov 2016 13:42:25 GMT\", \"dateUpdated\" : \"Fri, 11 Nov 2016 13:42:25 GMT\", \"region\" : \"Illinois\", \"country\" : \"US\", \"voiceEnabled\" : true, \"smsEnabled\" : true}, {\"phoneNumber\" : \"+13122290365\", \"alias\" : \"312-229-0365\", \"revision\" : 1, \"dateCreated\" : \"Fri, 11 Nov 2016 13:42:25 GMT\", \"dateUpdated\" : \"Fri, 11 Nov 2016 13:42:25 GMT\", \"region\" : \"Illinois\", \"country\" : \"US\", \"voiceEnabled\" : true, \"smsEnabled\" : true}]}");


                AvailablePhoneNumberList list = requester.get();

                Assert.IsNotNull(list);

                Assert.AreEqual(list.getLocalSize, 2);
                Assert.AreEqual((list.export()).Count, 2);

                AvailablePhoneNumber num = list.get(0) as AvailablePhoneNumber;

                Assert.IsNotNull(num);
                Assert.AreEqual(num.getAlias, "312-229-0330");
                Assert.AreEqual(num.getPhoneNumber, "+13122290330");

                type      = typeof(APIRequester);
                fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(list, "http://GetAvailableListTest:3000");
                }

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":2,\"end\":2,\"page\":1,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":null, \"availablePhoneNumbers\" : [ {\"phoneNumber\" : \"+13123004536\", \"alias\" : \"312-300-4536\", \"revision\" : 1, \"dateCreated\" : \"Fri, 11 Nov 2016 13:42:25 GMT\", \"dateUpdated\" : \"Fri, 11 Nov 2016 13:42:25 GMT\", \"region\" : \"Illinois\", \"country\" : \"US\", \"voiceEnabled\" : true, \"smsEnabled\" : true}]}");

                list.loadNextPage();

                Assert.IsNotNull(list);

                Assert.AreEqual(list.getLocalSize, 3);
                Assert.AreEqual((list.export()).Count, 3);

                num = list.get(2) as AvailablePhoneNumber;
                Assert.IsNotNull(num);
                Assert.AreEqual(num.getPhoneNumber, "+13123004536");
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void GetCallListTest()
        {
            try
            {
                CallsRequester callsRequester = new CallsRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       callsRequesterType = typeof(CallsRequester);
                MethodInfo persyUrlMethodInfo = callsRequesterType.GetMethod("setPersyUrl",
                                                                             BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                             null,
                                                                             new Type[] { typeof(System.String) },
                                                                             null);
                persyUrlMethodInfo.Invoke(callsRequester, new Object[] { "http://GetCallListTest:3000" });

                WebRequest.RegisterPrefix("http://GetCallListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":0,\"end\":1,\"page\":0,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls?cursor=492dc883a811bd0204204ea9047122f93a2788a2\",\"calls\":[{\"uri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b\",\"revision\":1,\"dateCreated\":\"Mon, 28 Mar 2016 19:58:21 GMT\",\"dateUpdated\":\"Mon, 28 Mar 2016 19:58:21 GMT\",\"callId\":\"CAfe92a5efbaf90f04bbec946a0d74dad520dd883b\",\"parentCallId\":null,\"accountId\":\"ACabe7063197551fe51671f9ac3a9708e9dad51c4d\",\"from\":\"847655770\",\"to\":\"+11112223333\",\"phoneNumberId\":null,\"status\":\"completed\",\"startTime\":\"Mon, 28 Mar 2016 19:58:21 GMT\",\"endTime\":\"Mon, 28 Mar 2016 19:58:30 GMT\",\"duration\":9,\"direction\":\"inbound\",\"answeredBy\":null,\"callerName\":null,\"subresourceUris\":{\"notifications\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b/Notifications\",\"recordings\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b/Recordings\"}},{\"uri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CA25c3c744acdedcdb92a44dbae42d486bf20028ab\",\"revision\":1,\"dateCreated\":\"Mon, 28 Mar 2016 20:03:42 GMT\",\"dateUpdated\":\"Mon, 28 Mar 2016 20:03:42 GMT\",\"callId\":\"CA25c3c744acdedcdb92a44dbae42d486bf20028ab\",\"parentCallId\":null,\"accountId\":\"ACabe7063197551fe51671f9ac3a9708e9dad51c4d\",\"from\":\"847655770\",\"to\":\"+11112223333\",\"phoneNumberId\":null,\"status\":\"completed\",\"startTime\":\"Mon, 28 Mar 2016 20:03:42 GMT\",\"endTime\":\"Mon, 28 Mar 2016 20:03:50 GMT\",\"duration\":8,\"direction\":\"inbound\",\"answeredBy\":null,\"callerName\":null,\"subresourceUris\":{\"notifications\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CA25c3c744acdedcdb92a44dbae42d486bf20028ab/Notifications\",\"recordings\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CA25c3c744acdedcdb92a44dbae42d486bf20028ab/Recordings\"}}]}");

                CallList callList = callsRequester.get();

                Assert.IsNotNull(callList);

                Assert.AreEqual(callList.getLocalSize, 2);
                Assert.AreEqual((callList.export()).Count, 2);

                Call call = callList.get(0) as Call;

                Assert.IsNotNull(call);
                Assert.AreEqual(call.getCallId, "CAfe92a5efbaf90f04bbec946a0d74dad520dd883b");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(callList, "http://GetCallListTest:3000");
                }

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":2,\"end\":2,\"page\":1,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":null,\"calls\":[{\"uri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd884b\",\"revision\":1,\"dateCreated\":\"Mon, 28 Mar 2016 19:58:21 GMT\",\"dateUpdated\":\"Mon, 28 Mar 2016 19:58:21 GMT\",\"callId\":\"CAfe92a5efbaf90f04bbec946a0d74dad520dd884b\",\"parentCallId\":null,\"accountId\":\"ACabe7063197551fe51671f9ac3a9708e9dad51c4d\",\"from\":\"847655770\",\"to\":\"+11112223333\",\"phoneNumberId\":null,\"status\":\"completed\",\"startTime\":\"Mon, 28 Mar 2016 19:58:21 GMT\",\"endTime\":\"Mon, 28 Mar 2016 19:58:30 GMT\",\"duration\":9,\"direction\":\"inbound\",\"answeredBy\":null,\"callerName\":null,\"subresourceUris\":{\"notifications\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b/Notifications\",\"recordings\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b/Recordings\"}}]}");

                callList.loadNextPage();

                Assert.IsNotNull(callList);

                Assert.AreEqual(callList.getLocalSize, 3);
                Assert.AreEqual((callList.export()).Count, 3);

                call = callList.get(2) as Call;
                Assert.IsNotNull(call);
                Assert.AreEqual(call.getCallId, "CAfe92a5efbaf90f04bbec946a0d74dad520dd884b");
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void QueueMemberListTest()
        {
            try
            {
                QueuesRequester queuesRequester = new QueuesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       callsRequesterType     = typeof(QueuesRequester);
                MethodInfo freeClimbUrlMethodInfo = callsRequesterType.GetMethod("SetFreeClimbUrl",
                                                                                 BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                                 null,
                                                                                 new Type[] { typeof(System.String) },
                                                                                 null);
                freeClimbUrlMethodInfo.Invoke(queuesRequester, new Object[] { "http://QueueMemberList:3000" });

                WebRequest.RegisterPrefix("http://QueueMemberList:3000", new TestWebRequestCreate());
                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"page\": 0, \"numPages\": 2, \"pageSize\": 2, \"total\": 3, \"start\": 0, \"end\": 1, \"nextPageUri\": \"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Queues&cursor=492dc883a811bd0204204ea9047122f93a2788a2\", \"queueMembers\": [{\"callId\": \"CA386025c9bf5d6052a1d1ea42b4d16662\", \"dateEnqueued\": \"Mon, 11 Aug 2014 22:00:14 GMT\",\"waitTime\": 30,\"position\": 1, \"uri\": \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Queues/QU5ef8732a3c49700934481addd5ce1659/Members/CA386025c9bf5d6052a1d1ea42b4d16662\"},{\"callId\": \"CA386025c9bf5d6052a1d1ea42b4d16662\", \"dateEnqueued\": \"Mon, 11 Aug 2014 22:00:14 GMT\",\"waitTime\": 30,\"position\": 1, \"uri\": \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Queues/QU5ef8732a3c49700934481addd5ce1659/Members/CA386025c9bf5d6052a1d1ea42b4d16662\"}]}");

                QueueMemberList queueMemberList = queuesRequester.getMembers("QU5ef8732a3c49700934481addd5ce1659");

                Assert.IsNotNull(queueMemberList);

                Assert.AreEqual(queueMemberList.getLocalSize, 2);
                Assert.AreEqual((queueMemberList.export()).Count, 2);

                QueueMember queueMember = queueMemberList.get(0) as QueueMember;

                Assert.IsNotNull(queueMember);
                Assert.AreEqual(queueMember.getCallId, "CA386025c9bf5d6052a1d1ea42b4d16662");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(queueMemberList, "http://QueueMemberList:3000");
                }

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"page\": 1, \"numPages\": 2, \"pageSize\": 2, \"total\": 3, \"start\": 2, \"end\": 2, \"nextPageUri\": null, \"queueMembers\": [{\"callId\": \"CA386025c9bf5d6052a1d1ea42b4d16663\", \"dateEnqueued\": \"Mon, 11 Aug 2014 22:00:14 GMT\",\"waitTime\": 30,\"position\": 1, \"uri\": \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Queues/ QU5ef8732a3c49700934481addd5ce1659/Members/CA386025c9bf5d6052a1d1ea42b4d16662\"}]}");

                queueMemberList.loadNextPage();

                Assert.IsNotNull(queueMemberList);

                Assert.AreEqual(queueMemberList.getLocalSize, 3);
                Assert.AreEqual((queueMemberList.export()).Count, 3);

                queueMember = queueMemberList.get(2) as QueueMember;

                Assert.IsNotNull(queueMember);
                Assert.AreEqual(queueMember.getCallId, "CA386025c9bf5d6052a1d1ea42b4d16663");
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void GetCallingNumberListTest()
        {
            try
            {
                CallingNumbersRequester requester = new CallingNumbersRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetCallingListTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetCallingListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":0,\"end\":1,\"page\":0,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/CallingNumbers&cursor=492dc883a811bd0204204ea9047122f93a2788a2\", \"callingNumbers\" : [{\"phoneNumber\" : \"+13033447438\", \"alias\" : \"new Calling number 1\", \"revision\" : 2, \"dateCreated\" : \"Wed, 01 Feb 2017 17:33:27 GMT\", \"dateUpdated\" : \"Wed, 01 Feb 2017 17:42:00 GMT\", \"callingNumberId\" : \"PN7bbef986a434fd30ba006551ed6cc507403b5e87\", \"uri\" : \"/Accounts/AC907d7e328b3a5b402fa908857e047a243a8949b1/CallingNumbers/PN7bbef986a434fd30ba006551ed6cc507403b5e87\", \"accountId\" : \"AC907d7e328b3a5b402fa908857e047a243a8949b1\"}, {\"phoneNumber\" : \"+13033447440\", \"alias\" : \"Calling number 2\", \"revision\" : 1, \"dateCreated\" : \"Wed, 01 Feb 2017 17:33:43 GMT\", \"dateUpdated\" : \"Wed, 01 Feb 2017 17:33:43 GMT\", \"callingNumberId\" : \"PNef08e0fcf2e37067d3f0a190671c6d0d45cefb63\", \"uri\" : \"/Accounts/AC907d7e328b3a5b402fa908857e047a243a8949b1/CallingNumbers/PNef08e0fcf2e37067d3f0a190671c6d0d45cefb63\", \"accountId\" : \"AC907d7e328b3a5b402fa908857e047a243a8949b1\"}]}");


                CallingNumberList list = requester.get();

                Assert.IsNotNull(list);

                Assert.AreEqual(list.getLocalSize, 2);
                Assert.AreEqual((list.export()).Count, 2);

                CallingNumber num = list.get(0) as CallingNumber;

                Assert.IsNotNull(num);
                Assert.AreEqual(num.getCallingNumberId, "PN7bbef986a434fd30ba006551ed6cc507403b5e87");

                type      = typeof(APIRequester);
                fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(list, "http://GetCallingListTest:3000");
                }

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":2,\"end\":2,\"page\":1,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":null, \"callingNumbers\" : [ {\"phoneNumber\" : \"+13033447440\", \"alias\" : \"Calling number 2\", \"revision\" : 1, \"dateCreated\" : \"Wed, 01 Feb 2017 17:33:43 GMT\", \"dateUpdated\" : \"Wed, 01 Feb 2017 17:33:43 GMT\", \"callingNumberId\" : \"PNef08e0fcf2e37067d3f0a190671c6d0d45cefb63\", \"uri\" : \"/Accounts/AC907d7e328b3a5b402fa908857e047a243a8949b1/CallingNumbers/PNef08e0fcf2e37067d3f0a190671c6d0d45cefb63\", \"accountId\" : \"AC907d7e328b3a5b402fa908857e047a243a8949b1\"}]}");

                list.loadNextPage();

                Assert.IsNotNull(list);

                Assert.AreEqual(list.getLocalSize, 3);
                Assert.AreEqual((list.export()).Count, 3);

                num = list.get(2) as CallingNumber;
                Assert.IsNotNull(num);
                Assert.AreEqual(num.getCallingNumberId, "PNef08e0fcf2e37067d3f0a190671c6d0d45cefb63");
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Beispiel #21
0
        public void GetIncomingNumberListTest()
        {
            try
            {
                IncomingPhoneNumbersRequester requester = new IncomingPhoneNumbersRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetIncomingListTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetIncomingListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":0,\"end\":1,\"page\":0,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/CallingNumbers&cursor=492dc883a811bd0204204ea9047122f93a2788a2\", \"incomingPhoneNumbers\" : [{\"phoneNumber\" : \"+13126516046\", \"alias\" : \"312-651-6046\", \"revision\" : 2, \"dateCreated\" : \"Fri, 11 Nov 2016 13:42:22 GMT\", \"dateUpdated\" : \"Thu, 08 Dec 2016 20:41:18 GMT\", \"phoneNumberId\" : \"PN5fdc25a5db02d03aa1da1f85f18d6bfa6e45a701\", \"region\" : \"Illinois\", \"country\" : \"US\", \"voiceEnabled\" : true, \"smsEnabled\" : true, \"applicationId\" : \"APbd38defccbf9a1db844551aa8ae0531a876bc84b\", \"uri\" : \"/Accounts/AC907d7e328b3a5b402fa908857e047a243a8949b1/IncomingPhoneNumbers/PN5fdc25a5db02d03aa1da1f85f18d6bfa6e45a701\", \"accountId\" : \"AC907d7e328b3a5b402fa908857e047a243a8949b1\"}, {\"phoneNumber\" : \"+13124881429\", \"alias\" : \"312-488-1429\", \"revision\" : 2, \"dateCreated\" : \"Fri, 11 Nov 2016 13:42:24 GMT\", \"dateUpdated\" : \"Sun, 15 Jan 2017 18:37:53 GMT\", \"phoneNumberId\" : \"PN5b881cc45548df1d015b7450fa9e3f1e301e1b97\", \"region\" : \"Illinois\", \"country\" : \"US\", \"voiceEnabled\" : true, \"smsEnabled\" : true, \"applicationId\" : \"APabfb2706f416285399ae6bdd96d07b3416f6d4ce\", \"uri\" : \"/Accounts/AC907d7e328b3a5b402fa908857e047a243a8949b1/IncomingPhoneNumbers/PN5b881cc45548df1d015b7450fa9e3f1e301e1b97\", \"accountId\" : \"AC907d7e328b3a5b402fa908857e047a243a8949b1\"}]}");


                IncomingPhoneNumberList list = requester.get();

                Assert.IsNotNull(list);

                Assert.AreEqual(list.getLocalSize, 2);
                Assert.AreEqual((list.export()).Count, 2);

                IncomingPhoneNumber num = list.get(0) as IncomingPhoneNumber;

                Assert.IsNotNull(num);
                Assert.AreEqual(num.getPhoneNumberId, "PN5fdc25a5db02d03aa1da1f85f18d6bfa6e45a701");

                type      = typeof(APIRequester);
                fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(list, "http://GetIncomingListTest:3000");
                }

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":2,\"end\":2,\"page\":1,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":null, \"incomingPhoneNumbers\" : [{\"phoneNumber\" : \"+13129975947\", \"alias\" : \"312-997-5947\", \"revision\" : 1, \"dateCreated\" : \"Fri, 11 Nov 2016 13:42:24 GMT\", \"dateUpdated\" : \"Thu, 26 Jan 2017 16:37:43 GMT\", \"phoneNumberId\" : \"PNeced5e8f2764adcc0cd0637bc52e6f45583458a6\", \"region\" : \"Illinois\", \"country\" : \"US\", \"voiceEnabled\" : true, \"smsEnabled\" : true, \"applicationId\" : null, \"uri\" : \"/Accounts/AC907d7e328b3a5b402fa908857e047a243a8949b1/IncomingPhoneNumbers/PNeced5e8f2764adcc0cd0637bc52e6f45583458a6\", \"accountId\" : \"AC907d7e328b3a5b402fa908857e047a243a8949b1\"}]}");

                list.loadNextPage();

                Assert.IsNotNull(list);

                Assert.AreEqual(list.getLocalSize, 3);
                Assert.AreEqual((list.export()).Count, 3);

                num = list.get(2) as IncomingPhoneNumber;
                Assert.IsNotNull(num);
                Assert.AreEqual(num.getPhoneNumberId, "PNeced5e8f2764adcc0cd0637bc52e6f45583458a6");
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void GetApplicationListTest()
        {
            try
            {
                ApplicationsRequester requester = new ApplicationsRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetApplicationListTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetApplicationListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":0,\"end\":1,\"page\":0,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Applications&cursor=492dc883a811bd0204204ea9047122f93a2788a2\", \"applications\" : [{ \"uri\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Applications/APe4238465edbc017acfbddfe80c66594ef6c72669\", \"revision\" : 2, \"dateCreated\" : \"Mon, 30 Jan 2017 23:35:00 GMT\", \"dateUpdated\" : \"Mon, 30 Jan 2017 23:44:39 GMT\", \"applicationId\" : \"APe4238465edbc017acfbddfe80c66594ef6c72669\", \"accountId\" : \"AC66c1bebe590a6389f60efa0ee9ce74d44bc29747\", \"alias\" : \"new test application 1\", \"voiceUrl\" : \"http://CreateAccountTest:3000/VoiceUrl2\", \"callConnectUrl\" : \"http://CreateAccountTest:3000/CCUrl2\", \"voiceFallbackUrl\" : \"http://CreateAccountTest:3000/VoiceUrl2\", \"statusCallbackUrl\" : \"http://CreateAccountTest:3000/Status2\"}, { \"uri\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Applications/AP6b60f3f88a46cc0ab42cb82781bdaa124a435076\", \"revision\" : 1, \"dateCreated\" : \"Mon, 30 Jan 2017 23:35:44 GMT\", \"dateUpdated\" : \"Mon, 30 Jan 2017 23:35:44 GMT\", \"applicationId\" : \"AP6b60f3f88a46cc0ab42cb82781bdaa124a435076\", \"accountId\" : \"AC66c1bebe590a6389f60efa0ee9ce74d44bc29747\", \"alias\" : \"test application 2\", \"voiceUrl\" : \"http://CreateAccountTest:3000/VoiceUrl\", \"callConnectUrl\" : \"http://CreateAccountTest:3000/CCUrl\", \"voiceFallbackUrl\" : \"http://CreateAccountTest:3000/VoiceUrl\", \"statusCallbackUrl\" : \"http://CreateAccountTest:3000/Status\"}]}");


                ApplicationList appList = requester.get();

                Assert.IsNotNull(appList);

                Assert.AreEqual(appList.getLocalSize, 2);
                Assert.AreEqual((appList.export()).Count, 2);

                Application app = appList.get(0) as Application;

                Assert.IsNotNull(app);
                Assert.AreEqual(app.getApplicationId, "APe4238465edbc017acfbddfe80c66594ef6c72669");

                type      = typeof(APIRequester);
                fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(appList, "http://GetApplicationListTest:3000");
                }

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":2,\"end\":2,\"page\":1,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":null, \"applications\" : [ { \"uri\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Applications/AP6b60f3f88a46cc0ab42cb82781bdaa124a435076\", \"revision\" : 1, \"dateCreated\" : \"Mon, 30 Jan 2017 23:35:44 GMT\", \"dateUpdated\" : \"Mon, 30 Jan 2017 23:35:44 GMT\", \"applicationId\" : \"AP6b60f3f88a46cc0ab42cb82781bdaa124a435076\", \"accountId\" : \"AC66c1bebe590a6389f60efa0ee9ce74d44bc29747\", \"alias\" : \"test application 2\", \"voiceUrl\" : \"http://CreateAccountTest:3000/VoiceUrl\", \"callConnectUrl\" : \"http://CreateAccountTest:3000/CCUrl\", \"voiceFallbackUrl\" : \"http://CreateAccountTest:3000/VoiceUrl\", \"statusCallbackUrl\" : \"http://CreateAccountTest:3000/Status\"}]}");

                appList.loadNextPage();

                Assert.IsNotNull(appList);

                Assert.AreEqual(appList.getLocalSize, 3);
                Assert.AreEqual((appList.export()).Count, 3);

                app = appList.get(2) as Application;
                Assert.IsNotNull(app);
                Assert.AreEqual(app.getApplicationId, "AP6b60f3f88a46cc0ab42cb82781bdaa124a435076");
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void GetRecordingListTest()
        {
            try
            {
                RecordingsRequester recordingsRequester = new RecordingsRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(recordingsRequester, "http://GetRecordingListTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetRecordingListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":0,\"end\":1,\"page\":0,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Recordings&cursor=492dc883a811bd0204204ea9047122f93a2788a2\",\"recordings\":[{\"uri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Recordings/REb1eecfce410141ad1749c0fc84dfbb6fc4c2a810\",\"revision\":1,\"dateCreated\":\"Mon, 27 Jun 2016 17:53:55 GMT\",\"dateUpdated\":\"Mon, 27 Jun 2016 17:53:55 GMT\",\"recordingId\":\"REb1eecfce410141ad1749c0fc84dfbb6fc4c2a810\",\"accountId\":\"ACabe7063197551fe51671f9ac3a9708e9dad51c4d\",\"callId\":\"CF3cb8a52f461bcf64cbd3111d9492c3f61943eef9\",\"duration\":9},{\"uri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Recordings/RE9cae4798ca0803cbd52209c1bfe99d25027cc2cf\",\"revision\":1,\"dateCreated\":\"Mon, 27 Jun 2016 20:38:16 GMT\",\"dateUpdated\":\"Mon, 27 Jun 2016 20:38:16 GMT\",\"recordingId\":\"RE9cae4798ca0803cbd52209c1bfe99d25027cc2cf\",\"accountId\":\"ACabe7063197551fe51671f9ac3a9708e9dad51c4d\",\"callId\":\"CFa32e912be62fff5d0b1bcd99610a69281918800a\",\"duration\":9}]}");

                RecordingList recordingList = recordingsRequester.getMeta();

                Assert.IsNotNull(recordingList);

                Assert.AreEqual(recordingList.getLocalSize, 2);
                Assert.AreEqual((recordingList.export()).Count, 2);

                Recording recording = recordingList.get(0) as Recording;

                Assert.IsNotNull(recording);
                Assert.AreEqual(recording.getRecordingId, "REb1eecfce410141ad1749c0fc84dfbb6fc4c2a810");

                type      = typeof(APIRequester);
                fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(recordingList, "http://GetRecordingListTest:3000");
                }

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":2,\"end\":2,\"page\":1,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":null,\"recordings\":[{\"uri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Recordings/REb1eecfce410141ad1749c0fc84dfbb6fc4c2a815\",\"revision\":1,\"dateCreated\":\"Mon, 27 Jun 2016 17:53:55 GMT\",\"dateUpdated\":\"Mon, 27 Jun 2016 17:53:55 GMT\",\"recordingId\":\"REb1eecfce410141ad1749c0fc84dfbb6fc4c2a815\",\"accountId\":\"ACabe7063197551fe51671f9ac3a9708e9dad51c4d\",\"callId\":\"CF3cb8a52f461bcf64cbd3111d9492c3f61943eef9\",\"duration\":9}]}");

                recordingList.loadNextPage();

                Assert.IsNotNull(recordingList);

                Assert.AreEqual(recordingList.getLocalSize, 3);
                Assert.AreEqual((recordingList.export()).Count, 3);

                recording = recordingList.get(2) as Recording;
                Assert.IsNotNull(recording);
                Assert.AreEqual(recording.getRecordingId, "REb1eecfce410141ad1749c0fc84dfbb6fc4c2a815");
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Beispiel #24
0
        public void GetMessageListWithFiltersTest()
        {
            try
            {
                MessagesRequester requester = new MessagesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetMessageListTest:3000");
                }

                string to   = "+18475978014";
                string from = "+12248806205";
                string text = "Hello World";

                WebRequest.RegisterPrefix("http://GetMessageListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":1,\"start\":0,\"end\":0,\"page\":0,\"numPages\":1,\"pageSize\":2,\"nextPageUri\":null, \"messages\" : [{\"uri\" : \"/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Messages/MM16ac1bcbd6f4895c89a798571e89e1e715892926\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"messageId\" : \"MM16ac1bcbd6f4895c89a798571e89e1e715892926\", \"accountId\" : \"AC736ca2078721a9a41fb47f07bf40d9e21cb304da\", \"from\" : \"" + from + "\", \"to\" : \"" + to + "\", \"text\" : \"" + text + "\", \"direction\" : \"inbound\", \"status\" : \"received\"}]}");

                MessagesSearchFilter filters = new MessagesSearchFilter();
                filters.setFrom(from);
                filters.setDirection(com.persephony.EMessageDirection.Inbound);
                DateTime now           = DateTime.Now;
                DateTime yesterday     = now.AddDays(-1);
                string   dateFormatStr = "yyyy-MM-dd HH:mm:ss";
                filters.setBeginTime(yesterday.ToString(dateFormatStr));
                filters.setEndTime(now.ToString(dateFormatStr));
                MessageList msgList = requester.get(filters);

                Assert.IsNotNull(msgList);

                Assert.AreEqual(msgList.getLocalSize, 1);
                Assert.AreEqual((msgList.export()).Count, 1);

                Message msg = msgList.get(0) as Message;

                Assert.IsNotNull(msg);
                Assert.AreEqual(msg.getMessageId, "MM16ac1bcbd6f4895c89a798571e89e1e715892926");
                Assert.AreEqual(msg.getFrom, from);
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Beispiel #25
0
        public void MakeAInitialSmsRequestWithOptionalFieldsTest()
        {
            try
            {
                MessagesRequester messagesRequester = new MessagesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       messagesRequesterType = typeof(MessagesRequester);
                MethodInfo persyUrlMethodInfo    = messagesRequesterType.GetMethod("setPersyUrl",
                                                                                   BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                                   null,
                                                                                   new Type[] { typeof(System.String) },
                                                                                   null);
                persyUrlMethodInfo.Invoke(messagesRequester, new Object[] { "http://MakeAInitialSmsRequestTest:3000" });

                WebRequest.RegisterPrefix("http://MakeAInitialSmsRequestTest:3000", new TestWebRequestCreate());

                string         to       = "+18475978014";
                string         from     = "+12248806205";
                string         text     = "Hello World";
                string         notifUrl = "http://server/msgNotif";
                MessageOptions options  = new MessageOptions();
                options.setNotificationUrl(notifUrl);

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Messages/MM16ac1bcbd6f4895c89a798571e89e1e715892924\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"messageId\" : \"MM16ac1bcbd6f4895c89a798571e89e1e715892924\", \"accountId\" : \"AC736ca2078721a9a41fb47f07bf40d9e21cb304da\", \"from\" : \"" + from + "\", \"to\" : \"" + to + "\", \"text\" : \"" + text + "\", \"direction\" : \"outbound\", \"status\" : \"sending\", \"notificationUrl\" : \"" + notifUrl + "\"}");
                Message msg = messagesRequester.create(from, to, text, options);

                Assert.IsNotNull(msg);
                Assert.IsNotNull(msg.getUri);
                Assert.AreEqual(msg.getUri, "/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Messages/MM16ac1bcbd6f4895c89a798571e89e1e715892924");
                Assert.AreEqual(msg.getRevision, 1);
                Assert.IsNotNull(msg.getDateCreated);
                Assert.IsNotNull(msg.getDateUpdated);
                Assert.AreEqual(msg.getDirection, com.persephony.EMessageDirection.Outbound);
                Assert.AreEqual(msg.getStatus, com.persephony.EMessageStatus.Sending);
                Assert.AreEqual(msg.getFrom, from);
                Assert.AreEqual(msg.getTo, to);
                Assert.AreEqual(msg.getText, text);
                Assert.AreEqual(msg.getNotificationUrl, notifUrl);
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Beispiel #26
0
        public void GetIncomingNumberListUsingFilterTest()
        {
            try
            {
                IncomingPhoneNumbersRequester requester = new IncomingPhoneNumbersRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetCallingListTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetCallingListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,

                                                                             "{ \"total\" : 1, \"start\" : 0, \"end\" : 0, \"page\" : 0, \"numPages\" : 1, \"pageSize\" : 100, \"nextPageUri\" : null, \"incomingPhoneNumbers\" : [{\"phoneNumber\" : \"+13126516046\", \"alias\" : \"312-651-6046\", \"revision\" : 2, \"dateCreated\" : \"Fri, 11 Nov 2016 13:42:22 GMT\", \"dateUpdated\" : \"Thu, 08 Dec 2016 20:41:18 GMT\", \"phoneNumberId\" : \"PN5fdc25a5db02d03aa1da1f85f18d6bfa6e45a701\", \"region\" : \"Illinois\", \"country\" : \"US\", \"voiceEnabled\" : true, \"smsEnabled\" : true, \"applicationId\" : \"APbd38defccbf9a1db844551aa8ae0531a876bc84b\", \"uri\" : \"/Accounts/AC907d7e328b3a5b402fa908857e047a243a8949b1/IncomingPhoneNumbers/PN5fdc25a5db02d03aa1da1f85f18d6bfa6e45a701\", \"accountId\" : \"AC907d7e328b3a5b402fa908857e047a243a8949b1\"}]}");

                IncomingPhoneNumbersSearchFilter filter = new IncomingPhoneNumbersSearchFilter();
                filter.setPhoneNumber("^\\+1[0-9]{10}$");
                filter.setAlias("312-651-6046");
                IncomingPhoneNumberList list = requester.get(filter);

                Assert.IsNotNull(list);

                Assert.AreEqual(list.getLocalSize, 1);
                Assert.AreEqual((list.export()).Count, 1);

                IncomingPhoneNumber num = list.get(0) as IncomingPhoneNumber;

                Assert.IsNotNull(num);
                Assert.AreEqual(num.getPhoneNumber, "+13126516046");
                Assert.AreEqual(num.getAlias, "312-651-6046");
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Beispiel #27
0
        public void GetMessageTest()
        {
            try
            {
                MessagesRequester requester = new MessagesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetMessageTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetMessageTest:3000", new TestWebRequestCreate());

                string to       = "+18475978014";
                string from     = "+12248806205";
                string text     = "Hello World";
                string notifUrl = "http://server/msgNotif";

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Messages/MM16ac1bcbd6f4895c89a798571e89e1e715892924\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"messageId\" : \"MM16ac1bcbd6f4895c89a798571e89e1e715892924\", \"accountId\" : \"AC736ca2078721a9a41fb47f07bf40d9e21cb304da\", \"from\" : \"" + from + "\", \"to\" : \"" + to + "\", \"text\" : \"" + text + "\", \"direction\" : \"outbound\", \"status\" : \"queued\", \"notificationUrl\" : \"" + notifUrl + "\"}");

                Message msg = requester.get("MM16ac1bcbd6f4895c89a798571e89e1e715892924");

                Assert.IsNotNull(msg);
                Assert.AreEqual(msg.getMessageId, "MM16ac1bcbd6f4895c89a798571e89e1e715892924");
                Assert.AreEqual(msg.getFrom, from);
                Assert.AreEqual(msg.getTo, to);
                Assert.AreEqual(msg.getText, text);
                Assert.AreEqual(msg.getDirection, com.persephony.EMessageDirection.Outbound);
                Assert.AreEqual(msg.getStatus, com.persephony.EMessageStatus.Queued);
                Assert.AreEqual(msg.getNotificationUrl, notifUrl);
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void GetCallingNumberListUsingFilterTest()
        {
            try
            {
                CallingNumbersRequester requester = new CallingNumbersRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetCallingListTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetCallingListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":1,\"start\":0,\"end\":0,\"page\":0,\"numPages\":1,\"pageSize\":2,\"nextPageUri\":null, \"callingNumbers\" : [{\"phoneNumber\" : \"+13033447438\", \"alias\" : \"Calling number 1\", \"revision\" : 2, \"dateCreated\" : \"Wed, 01 Feb 2017 17:33:27 GMT\", \"dateUpdated\" : \"Wed, 01 Feb 2017 17:42:00 GMT\", \"callingNumberId\" : \"PN7bbef986a434fd30ba006551ed6cc507403b5e87\", \"uri\" : \"/Accounts/AC907d7e328b3a5b402fa908857e047a243a8949b1/CallingNumbers/PN7bbef986a434fd30ba006551ed6cc507403b5e87\", \"accountId\" : \"AC907d7e328b3a5b402fa908857e047a243a8949b1\"}]}");

                CallingNumbersSearchFilter filter = new CallingNumbersSearchFilter();
                filter.setPhoneNumber("+13033447438");
                filter.setAlias("Calling number 1");
                CallingNumberList list = requester.get(filter);

                Assert.IsNotNull(list);

                Assert.AreEqual(list.getLocalSize, 1);
                Assert.AreEqual((list.export()).Count, 1);

                CallingNumber num = list.get(0) as CallingNumber;

                Assert.IsNotNull(num);
                Assert.AreEqual(num.getPhoneNumber, "+13033447438");
                Assert.AreEqual(num.getAlias, "Calling number 1");
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void GetApplicationListByAliasTest()
        {
            try
            {
                ApplicationsRequester requester = new ApplicationsRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetApplicationListTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetApplicationListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":1,\"start\":0,\"end\":0,\"page\":0,\"numPages\":1,\"pageSize\":2,\"nextPageUri\":null, \"applications\" : [{ \"uri\" : \"/Accounts/AC66c1bebe590a6389f60efa0ee9ce74d44bc29747/Applications/APe4238465edbc017acfbddfe80c66594ef6c72669\", \"revision\" : 2, \"dateCreated\" : \"Mon, 30 Jan 2017 23:35:00 GMT\", \"dateUpdated\" : \"Mon, 30 Jan 2017 23:44:39 GMT\", \"applicationId\" : \"APe4238465edbc017acfbddfe80c66594ef6c72669\", \"accountId\" : \"AC66c1bebe590a6389f60efa0ee9ce74d44bc29747\", \"alias\" : \"new test application 1\", \"voiceUrl\" : \"http://CreateAccountTest:3000/VoiceUrl2\", \"callConnectUrl\" : \"http://CreateAccountTest:3000/CCUrl2\", \"voiceFallbackUrl\" : \"http://CreateAccountTest:3000/VoiceUrl2\", \"statusCallbackUrl\" : \"http://CreateAccountTest:3000/Status2\"}]}");

                ApplicationsSearchFilters filters = new ApplicationsSearchFilters();
                filters.setAlias("new test application 1");
                ApplicationList appList = requester.get(filters);

                Assert.IsNotNull(appList);

                Assert.AreEqual(appList.getLocalSize, 1);
                Assert.AreEqual((appList.export()).Count, 1);

                Application app = appList.get(0) as Application;

                Assert.IsNotNull(app);
                Assert.AreEqual(app.getApplicationId, "APe4238465edbc017acfbddfe80c66594ef6c72669");
                Assert.AreEqual(app.getAlias, "new test application 1");
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void GetRecordingListByCallIdTest()
        {
            try
            {
                RecordingsRequester recordingsRequester = new RecordingsRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(recordingsRequester, "http://GetRecordingListTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetRecordingListTest:3000/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Recordings?callId=CF3cb8a52f461bcf64cbd3111d9492c3f61943eef9", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":1,\"start\":0,\"end\":0,\"page\":1,\"numPages\":1,\"pageSize\":20,\"nextPageUri\":null,\"recordings\":[{\"uri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Recordings/REb1eecfce410141ad1749c0fc84dfbb6fc4c2a815\",\"revision\":1,\"dateCreated\":\"Mon, 27 Jun 2016 17:53:55 GMT\",\"dateUpdated\":\"Mon, 27 Jun 2016 17:53:55 GMT\",\"recordingId\":\"REb1eecfce410141ad1749c0fc84dfbb6fc4c2a815\",\"accountId\":\"ACabe7063197551fe51671f9ac3a9708e9dad51c4d\",\"callId\":\"CF3cb8a52f461bcf64cbd3111d9492c3f61943eef9\",\"duration\":9}]}");

                RecordingsSearchFilters filters = new RecordingsSearchFilters();
                filters.setCallId("CF3cb8a52f461bcf64cbd3111d9492c3f61943eef9");
                RecordingList recordingList = recordingsRequester.getMeta(filters);

                Assert.IsNotNull(recordingList);

                Assert.AreEqual(recordingList.getLocalSize, 1);
                Assert.AreEqual((recordingList.export()).Count, 1);

                Recording recording = recordingList.get(0) as Recording;

                Assert.IsNotNull(recording);
                Assert.AreEqual(recording.getRecordingId, "REb1eecfce410141ad1749c0fc84dfbb6fc4c2a815");
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }