예제 #1
0
        public void AvailableTollFreePhoneNumbersShouldReturnAvailablePhoneNumbersList()
        {
            var account = new TwilioAccountMock();
            var phoneAutomation = new PhoneAutomation(account);
            var availablePhoneNumbers = phoneAutomation.AvailableTollFreePhoneNumbers();

            Assert.IsNotNull(availablePhoneNumbers);
        }
예제 #2
0
        public void GetSubAccountsReturnsAccountListResource()
        {
            var account = new TwilioAccountMock();
            var phoneAutomation = new PhoneAutomation(account);
            var accounts = phoneAutomation.GetSubAccounts();

            Assert.IsNotNull(accounts);
        }
예제 #3
0
        public void AvailableLocalPhoneNumbersByAreaCodeShouldReturnAvailablePhoneNumbersList()
        {
            var account = new TwilioAccountMock();
            var phoneAutomation = new PhoneAutomation(account);
            var availablePhoneNumbers = phoneAutomation.AvailableLocalPhoneNumbers(1);

            Assert.IsNotNull(availablePhoneNumbers);
        }
예제 #4
0
        public void CreateSubAccountReturnsNewAccountResource()
        {
            var account = new TwilioAccountMock();
            var phoneAutomation = new PhoneAutomation(account);
            var twilioAccount = phoneAutomation.CreateSubAccount("My new account test");

            Assert.IsNotNull(twilioAccount);
        }
예제 #5
0
        public void ProvisionNumberShouldReturnNewNumberResource()
        {
            var account = new TwilioAccountMock();
            var phoneAutomation = new PhoneAutomation(account);
            var number = phoneAutomation.ProvisionPhoneNumber("555-555-5555");

            Assert.IsNotNull(number);
        }
예제 #6
0
 public void CallingInvalidJsonMethodShouldReturnNotImplementedException()
 {
     try
     {
         var account = new TwilioAccountMock();
         account.request("fake_url", "GET");
     }
     catch (System.Exception ex)
     {
         Assert.IsInstanceOfType(ex, typeof(System.NotImplementedException));
         Assert.IsTrue(ex.Message.Contains("Method is not implemented"));
     }
     
 }
예제 #7
0
        public void SMSListShouldReturnListOfSMSResources()
        {
            var account = new TwilioAccountMock();
            var phoneAutomation = new PhoneAutomation(account);
            var smsList = phoneAutomation.SMSMessageList();

            Assert.IsNotNull(smsList);
            Assert.IsNotNull(smsList.sms_messages);
        }
예제 #8
0
        public void FetchingSMSResourceByIdShouldReturnSMSResource()
        {
            var account = new TwilioAccountMock();
            var phoneAutomation = new PhoneAutomation(account);
            var sms = phoneAutomation.GetSMSMessage("fake_guid"); //some random guid

            Assert.IsNotNull(sms);
        }
예제 #9
0
        public void SendSMSMessageShouldReturnSMSMessageResource()
        {
            var account = new TwilioAccountMock();
            var phoneAutomation = new PhoneAutomation(account);
            var message = phoneAutomation.SendSMSMessage("Test_From", "Test_To", "Test_body");

            Assert.IsNotNull(message);
        }
예제 #10
0
        public void DeleteProvisionedPhoneNumberWithNullObjectShouldReturnArgumentNullException()
        {
            try
            {
                var account = new TwilioAccountMock();
                var phoneAutomation = new PhoneAutomation(account);

                phoneAutomation.DeleteProvisionedPhoneNumber(null);
            }
            catch (System.Exception ex)
            {
                Assert.IsInstanceOfType(ex, typeof(System.ArgumentNullException));
            }
        }
예제 #11
0
        public void DeleteProvisionedPhoneNumberWithValidPhoneObjectShouldReturnNullBody()
        {
            var account = new TwilioAccountMock();
            var phoneAutomation = new PhoneAutomation(account);

            var phoneNumber = new PhoneNumber{
                sid = "1", phone_number = "1"
            };
            phoneAutomation.DeleteProvisionedPhoneNumber(phoneNumber);
        }
예제 #12
0
 public void IncomingPhoneNumbersWithNowParametersShouldThrowNullReferenceError()
 {
     try
     {
         var account = new TwilioAccountMock();
         var phoneAutomation = new PhoneAutomation(account);
         phoneAutomation.IncomingPhoneNumbers();
         Assert.Fail("Cannot call this method without params");
     }
     catch (System.Exception ex)
     {
         Assert.IsInstanceOfType(ex, typeof(System.ArgumentNullException));
         Assert.IsTrue(ex.Message.Contains("missing phoneNumber"));
     }
 }
예제 #13
0
        public void IncomingPhoneNumbersByFriendlyNameShouldReturnListOfPhoneNumbers()
        {
            var account = new TwilioAccountMock();
            var phoneAutomation = new PhoneAutomation(account);
            var numbers = phoneAutomation.IncomingPhoneNumbers(phoneNumber: "555-555-5555", friendlyName: "test");

            Assert.IsNotNull(numbers);
        }