public void Authenticate_InvalidCredentials_AuthenticationException() { var smsManager = new TwilloSMSService(); Assert.ThrowsException <Twilio.Exceptions.AuthenticationException>( () => smsManager.Authenticate(), "Expected AuthenticationException when using invalid from number!"); }
public void SendSMSAsync_ValidNumberInvalidCredentials_AuthenticationException() { var smsManager = new TwilloSMSService(); Assert.ThrowsExceptionAsync <Twilio.Exceptions.AuthenticationException>( async() => await smsManager.SendSMSAsync(ValidToNumber, ValidFromNumber, SMSMessage), "Expected AuthenticationException when using invalid from number!"); }
public void Authenticate_ValidCredentials_Success() { var smsManager = new TwilloSMSService { AccountSID = AccountSID, AuthToken = AuthToken }; Assert.IsTrue(smsManager.Authenticate()); }
public void SendSMS_ValidFromNumber_Queued() { var smsManager = new TwilloSMSService { AccountSID = AccountSID, AuthToken = AuthToken }; MessageResource messageResource = smsManager.SendSMS(ValidToNumber, ValidFromNumber, SMSMessage); Assert.IsNotNull(messageResource); Assert.IsTrue(messageResource.Status == MessageResource.StatusEnum.Queued); }
public async Task SendSMSAsync_QueueFullFromPhoneNumber_ApiException() { var smsManager = new TwilloSMSService { AccountSID = AccountSID, AuthToken = AuthToken }; var returnedException = await Assert.ThrowsExceptionAsync <Twilio.Exceptions.ApiException>( async() => await smsManager.SendSMSAsync(ValidToNumber, QueueFullFromPhoneNumber, SMSMessage), "Expected ApiException when using invalid from number!"); Assert.AreEqual(21611, returnedException.Code); }
public void SendSMS_NotSMSCapableFromPhoneNumber_ApiException() { var smsManager = new TwilloSMSService { AccountSID = AccountSID, AuthToken = AuthToken }; var returnedException = Assert.ThrowsException <Twilio.Exceptions.ApiException>( () => smsManager.SendSMS(ValidToNumber, NotSMSCapableFromPhoneNumber, SMSMessage), "Expected ApiException when using invalid from number!"); Assert.AreEqual(21606, returnedException.Code); }
public void SendSMS_CannotRecieveSMSToPhoneNumber_ApiException() { var smsManager = new TwilloSMSService { AccountSID = AccountSID, AuthToken = AuthToken }; var returnedException = Assert.ThrowsException <Twilio.Exceptions.ApiException>( () => smsManager.SendSMS(CannotRecieveSMSToNumber, ValidFromNumber, SMSMessage), "Expected ApiException when using invalid to number!"); Assert.AreEqual(21614, returnedException.Code); }