public void IntegrationTests_Numbers_BasicScenario() { if (!canProvision) { return; } var config = new KeyManager(); var phaxio = new PhaxioClient(config["api_key"], config["api_secret"]); // Find area codes to provision a number in var areaCodes = phaxio.ListAreaCodes(state: "DE"); Assert.Greater(areaCodes.Count(), 0, "There should be some area codes"); var areaCode = areaCodes.First(); // Provision a number var provisionedNumber = phaxio.ProvisionNumber(areaCode.Key); // Check to see if the number's listed on the account var accountNumbers = phaxio.ListNumbers(); if (!accountNumbers.Any(n => n.Number == provisionedNumber.Number)) { throw new AssertionException("ListNumbers should return newly provisioned number."); } Thread.Sleep(1000); // Release the number phaxio.ReleaseNumber(provisionedNumber.Number); Thread.Sleep(1000); // Check to see if the number's still listed on the account accountNumbers = phaxio.ListNumbers(); if (accountNumbers.Any(n => n.Number == provisionedNumber.Number)) { throw new AssertionException("ListNumbers should not return released number."); } }
public void UnitTests_Numbers_ListNumbers() { var clientBuilder = new IRestClientBuilder { Op = "numberList" }; var phaxio = new PhaxioClient(IRestClientBuilder.TEST_KEY, IRestClientBuilder.TEST_SECRET, clientBuilder.Build()); var actualNumbers = phaxio.ListNumbers(); var expectedNumbers = PocoFixtures.GetTestPhoneNumbers(); Assert.AreEqual(expectedNumbers.Count, actualNumbers.Count, "Number should be the same"); }
public void IntegrationTests_Numbers_BasicScenario() { var config = new KeyManager(); var phaxio = new PhaxioClient(config["api_key"], config["api_secret"]); // Find area codes to provision a number in var areaCodes = phaxio.ListAreaCodes(state: "DE"); Assert.Greater(areaCodes.Count(), 0, "There should be some area codes"); var areaCode = areaCodes.First(); // Provision a number var provisionedNumber = phaxio.ProvisionNumber(areaCode.Key); // Check to see if the number's listed on the account var accountNumbers = phaxio.ListNumbers(); if (!accountNumbers.Any(n => n.Number == provisionedNumber.Number)) { throw new AssertionException("ListNumbers should return newly provisioned number."); } Thread.Sleep(1000); // Release the number phaxio.ReleaseNumber(provisionedNumber.Number); Thread.Sleep(1000); // Check to see if the number's still listed on the account accountNumbers = phaxio.ListNumbers(); if (accountNumbers.Any(n => n.Number == provisionedNumber.Number)) { throw new AssertionException("ListNumbers should not return released number."); } }
public void UnitTests_Numbers_ListNumbersWithOptions() { var areaCode = "808"; var number = "8088675309"; Action<IRestRequest> requestAsserts = req => { Assert.AreEqual(req.Parameters[2].Value, areaCode); Assert.AreEqual(req.Parameters[3].Value, number); }; var clientBuilder = new IRestClientBuilder { Op = "numberList", RequestAsserts = requestAsserts }; var phaxio = new PhaxioClient(IRestClientBuilder.TEST_KEY, IRestClientBuilder.TEST_SECRET, clientBuilder.Build()); var actualNumbers = phaxio.ListNumbers(areaCode, number); var expectedNumbers = PocoFixtures.GetTestPhoneNumbers(); Assert.AreEqual(expectedNumbers.Count, actualNumbers.Count, "Number should be the same"); }
public void UnitTests_Numbers_ListNumbersWithOptions() { var areaCode = "808"; var number = "8088675309"; Action <IRestRequest> requestAsserts = req => { Assert.AreEqual(req.Parameters[2].Value, areaCode); Assert.AreEqual(req.Parameters[3].Value, number); }; var clientBuilder = new IRestClientBuilder { Op = "numberList", RequestAsserts = requestAsserts }; var phaxio = new PhaxioClient(IRestClientBuilder.TEST_KEY, IRestClientBuilder.TEST_SECRET, clientBuilder.Build()); var actualNumbers = phaxio.ListNumbers(areaCode, number); var expectedNumbers = PocoFixtures.GetTestPhoneNumbers(); Assert.AreEqual(expectedNumbers.Count, actualNumbers.Count, "Number should be the same"); }