public void IntegrationTests_Numbers_GetAreaCodes()
        {
            var config = new KeyManager();

            var phaxio = new PhaxioClient(config["api_key"], config["api_secret"]);

            var areaCodes = phaxio.ListAreaCodes(state: "FL");

            Assert.Greater(areaCodes.Count(), 0, "There should be some area codes");
        }
Beispiel #2
0
        public void IntegrationTests_Numbers_GetAreaCodes()
        {
            var config = new KeyManager();

            var phaxio = new PhaxioClient(config["api_key"], config["api_secret"]);

            var areaCodes = phaxio.ListAreaCodes(state:"HI");

            Assert.Greater(areaCodes.Count(), 0, "There should be some area codes");
        }
Beispiel #3
0
        public void UnitTests_AreaCodes_WithState()
        {
            Action<IRestRequest> requestAsserts = req =>
            {
                Assert.AreEqual(req.Parameters[0].Value, "ID");
            };

            var clientBuilder = new IRestClientBuilder { Op = "areaCodes", NoAuth = true, RequestAsserts = requestAsserts };

            var phaxio = new PhaxioClient(IRestClientBuilder.TEST_KEY, IRestClientBuilder.TEST_SECRET, clientBuilder.Build());

            var codes = phaxio.ListAreaCodes(state: "ID");
        }
Beispiel #4
0
        public void UnitTests_AreaCodes_NoOptions()
        {
            var clientBuilder = new IRestClientBuilder { Op = "areaCodes", NoAuth = true };

            var phaxio = new PhaxioClient(IRestClientBuilder.TEST_KEY, IRestClientBuilder.TEST_SECRET, clientBuilder.Build());

            var codes = phaxio.ListAreaCodes(tollFree: true);

            var expectedCodes = PocoFixtures.GetTestAreaCodes();

            Assert.AreEqual(expectedCodes.Count(), codes.Count(), "Number should be the same");
            Assert.AreEqual(expectedCodes["201"].City, codes["201"].City, "City should be the same");
            Assert.AreEqual(expectedCodes["201"].State, codes["201"].State, "State should be the same");
        }
Beispiel #5
0
        public void UnitTests_AreaCodes_WithState()
        {
            Action <IRestRequest> requestAsserts = req =>
            {
                Assert.AreEqual(req.Parameters[0].Value, "ID");
            };

            var clientBuilder = new IRestClientBuilder {
                Op = "areaCodes", NoAuth = true, RequestAsserts = requestAsserts
            };

            var phaxio = new PhaxioClient(IRestClientBuilder.TEST_KEY, IRestClientBuilder.TEST_SECRET, clientBuilder.Build());

            var codes = phaxio.ListAreaCodes(state: "ID");
        }
Beispiel #6
0
        public void UnitTests_AreaCodes_NoOptions()
        {
            var clientBuilder = new IRestClientBuilder {
                Op = "areaCodes", NoAuth = true
            };

            var phaxio = new PhaxioClient(IRestClientBuilder.TEST_KEY, IRestClientBuilder.TEST_SECRET, clientBuilder.Build());

            var codes = phaxio.ListAreaCodes(tollFree: true);

            var expectedCodes = PocoFixtures.GetTestAreaCodes();

            Assert.AreEqual(expectedCodes.Count(), codes.Count(), "Number should be the same");
            Assert.AreEqual(expectedCodes["201"].City, codes["201"].City, "City should be the same");
            Assert.AreEqual(expectedCodes["201"].State, codes["201"].State, "State should be the same");
        }
        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.");
            }
        }
Beispiel #8
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.");
            }
        }