public void TestCreateRequest() { var twilioRestClient = Substitute.For <ITwilioRestClient>(); var request = new Request( HttpMethod.Post, Twilio.Rest.Domain.Api, "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OutgoingCallerIds.json", "" ); request.AddPostParam("PhoneNumber", Serialize(new Twilio.Types.PhoneNumber("+987654321"))); twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { ValidationRequestResource.Create(new Twilio.Types.PhoneNumber("+987654321"), client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} twilioRestClient.Received().Request(request); }
public void VerifyCallerID() { PrintBanner(); Console.WriteLine("Please enter the name of the number that Hxngry will be using. (Mike's Phone, John's iPhone, Mary, etc)"); var numName = Console.ReadLine(); var validationRequest = ValidationRequestResource.Create( friendlyName: numName, phoneNumber: new Twilio.Types.PhoneNumber(this.user.Phone) ); Console.WriteLine("You will receive a call within the next minute, the call will request a verification code.\n"); Console.WriteLine("This is your verification code: " + validationRequest.ValidationCode); Console.WriteLine("Once you have entered the verification code you may press any key to continue..."); AppLoading(); PrintBanner(); Console.WriteLine("You will now be sent an SMS message verifying your number's authentication."); var message = MessageResource.Create( body: "Number verified.", from: new Twilio.Types.PhoneNumber("+15204629326"), to: new Twilio.Types.PhoneNumber(this.user.Phone) ); }