public void TestCreateZoneAsync(string name, ZoneType type)
        {
            using (var client = new CloudFlareClient(Credentials.Credentials.Authentication))
            {
                var account          = client.GetAccountsAsync().Result.Result.First();
                var zonesQueryResult = client.CreateZoneAsync(name, type, account).Result;

                Assert.NotNull(zonesQueryResult);
                Assert.Empty(zonesQueryResult.Errors);
                Assert.True(zonesQueryResult.Success);
            }
        }
Ejemplo n.º 2
0
        public static void TestGetAccountMembersAsync(int?page, int?perPage, OrderType?order)
        {
            using (var client = new CloudFlareClient(Credentials.Credentials.Authentication))
            {
                var accounts       = client.GetAccountsAsync().Result;
                var accountMembers = client.GetAccountMembersAsync(accounts.Result.First().Id, page, perPage, order).Result;

                Assert.NotNull(accountMembers);
                Assert.Empty(accountMembers.Errors);
                Assert.True(accountMembers.Success);
            }
        }
Ejemplo n.º 3
0
        public async Task TestGetAccountsAsync(int?page, int?perPage, OrderType?order)
        {
            using var client = new CloudFlareClient(Credentials.Credentials.Authentication);
            var accounts = await client.GetAccountsAsync(page, perPage, order);

            Assert.NotNull(accounts);
            Assert.True(accounts.Success);
            if (accounts.Errors != null)
            {
                Assert.Empty(accounts.Errors);
            }
        }
Ejemplo n.º 4
0
        public static void TestGetRolesAsync()
        {
            using (var client = new CloudFlareClient(Credentials.Credentials.Authentication))
            {
                var accounts = client.GetAccountsAsync().Result;
                var roles    = client.GetRolesAsync(accounts.Result.First().Id).Result;

                Assert.NotNull(roles);
                Assert.Empty(roles.Errors);
                Assert.True(roles.Success);
            }
        }
Ejemplo n.º 5
0
        public static void UpdateAccountAsync()
        {
            using var client = new CloudFlareClient(Credentials.Credentials.Authentication);
            var accounts       = client.GetAccountsAsync().Result;
            var updatedAccount = client.UpdateAccountAsync(accounts.Result.First().Id, accounts.Result.First().Name).Result;

            Assert.NotNull(updatedAccount);
            Assert.True(updatedAccount.Success);
            if (updatedAccount.Errors != null)
            {
                Assert.Empty(updatedAccount.Errors);
            }
        }
Ejemplo n.º 6
0
        public static void TestGetAccountDetailsAsync()
        {
            using var client = new CloudFlareClient(Credentials.Credentials.Authentication);
            var accounts       = client.GetAccountsAsync().Result;
            var accountDetails = client.GetAccountDetailsAsync(accounts.Result.First().Id).Result;

            Assert.NotNull(accountDetails);
            Assert.True(accountDetails.Success);
            if (accountDetails.Errors != null)
            {
                Assert.Empty(accountDetails.Errors);
            }
        }
Ejemplo n.º 7
0
        public async Task TestGetRolesAsync()
        {
            using var client = new CloudFlareClient(Credentials.Credentials.Authentication);
            var accounts = await client.GetAccountsAsync();

            var subscriptions = await client.GetAccountSubscriptionsAsync(accounts.Result.First().Id);

            Assert.NotNull(subscriptions);
            Assert.True(subscriptions.Success);
            if (subscriptions.Errors != null)
            {
                Assert.Empty(subscriptions.Errors);
            }
        }
Ejemplo n.º 8
0
        public async Task TestGetRoleDetailsAsync()
        {
            using var client = new CloudFlareClient(Credentials.Credentials.Authentication);
            var accounts = await client.GetAccountsAsync();

            var roles = await client.GetRolesAsync(accounts.Result.First().Id);

            var roleDetails = client.GetRoleDetailsAsync(accounts.Result.First().Id, roles.Result.First().Id).Result;

            Assert.NotNull(roleDetails);
            Assert.True(roleDetails.Success);
            if (roleDetails.Errors != null)
            {
                Assert.Empty(roleDetails.Errors);
            }
        }
        public MinimumPlanEnterpriseTheoryAttribute()
        {
            var hasEnterpriseLevelAccount = false;

            using (var client = new CloudFlareClient(Credentials.Credentials.Authentication))
            {
                var accounts = client.GetAccountsAsync().Result.Result;
                foreach (var account in accounts)
                {
                    var subscriptions = client.GetAccountSubscriptionsAsync(account.Id).Result.Result;
                    if (subscriptions.Any(subscription => subscription.RatePlan.Id == LegacyType.Enterprise))
                    {
                        hasEnterpriseLevelAccount = true;
                    }
                }
            }

            if (!hasEnterpriseLevelAccount)
            {
                Skip = "Minimum enterprise level account needed!";
            }
        }