Esempio n. 1
0
        public void UnitTests_Numbers_Release()
        {
            var number = "8088675309";

            Action <IRestRequest> requestAsserts = req =>
            {
                Assert.AreEqual(req.Parameters[2].Value, number);
            };

            var clientBuilder = new IRestClientBuilder {
                Op = "releaseNumber", RequestAsserts = requestAsserts
            };
            var phaxio = new PhaxioClient(IRestClientBuilder.TEST_KEY, IRestClientBuilder.TEST_SECRET, clientBuilder.Build());

            var result = phaxio.ReleaseNumber(number);

            Assert.True(result.Success, "Should be success.");
        }
Esempio n. 2
0
        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.");
            }
        }
Esempio n. 3
0
        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.");
            }
        }
Esempio n. 4
0
        public void UnitTests_Numbers_Release()
        {
            var number = "8088675309";

            Action<IRestRequest> requestAsserts = req =>
            {
                Assert.AreEqual(req.Parameters[2].Value, number);
            };

            var clientBuilder = new IRestClientBuilder { Op = "releaseNumber", RequestAsserts = requestAsserts };
            var phaxio = new PhaxioClient(IRestClientBuilder.TEST_KEY, IRestClientBuilder.TEST_SECRET, clientBuilder.Build());

            var result = phaxio.ReleaseNumber(number);

            Assert.True(result.Success, "Should be success.");
        }