public static void TestUpdateAccountMemberAsync()
        {
            using var client = new CloudFlareClient(Credentials.Credentials.Authentication);
            var accounts       = client.GetAccountsAsync().Result;
            var accountMembers = client.GetAccountMembersAsync(accounts.Result.First().Id).Result;

            var firstAccountMember = accountMembers.Result.First();

            var updatedMember = client.UpdateAccountMemberAsync(accounts.Result.First().Id, firstAccountMember.Id,
                                                                firstAccountMember.Roles, firstAccountMember.Code, firstAccountMember.User, MembershipStatus.Accepted).Result;

            Assert.NotNull(updatedMember);

            var notAvailable = new List <int>
            {
                1001, // super user?
            };

            if (!updatedMember.Errors.Any(x => notAvailable.Contains(x.Code)))
            {
                Assert.True(updatedMember.Success);
                if (updatedMember.Errors != null)
                {
                    Assert.Empty(updatedMember.Errors);
                }
            }
        }
Exemple #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);
            }
        }
Exemple #3
0
        public static void TestGetAccountMemberDetailsAsync()
        {
            using (var client = new CloudFlareClient(Credentials.Credentials.Authentication))
            {
                var accounts             = client.GetAccountsAsync().Result;
                var accountMembers       = client.GetAccountMembersAsync(accounts.Result.First().Id).Result;
                var accountMemberDetails = client.GetAccountMemberDetailsAsync(accounts.Result.First().Id, accountMembers.Result.First().Id).Result;

                Assert.NotNull(accountMemberDetails);
                Assert.Empty(accountMemberDetails.Errors);
                Assert.True(accountMemberDetails.Success);
            }
        }
Exemple #4
0
        public async Task TestGetAccountMemberDetailsAsync()
        {
            using var client = new CloudFlareClient(Credentials.Credentials.Authentication);
            var accounts = await client.GetAccountsAsync();

            var accountMembers = await client.GetAccountMembersAsync(accounts.Result.First().Id);

            var accountMemberDetails = client.GetAccountMemberDetailsAsync(accounts.Result.First().Id, accountMembers.Result.First().Id).Result;

            Assert.NotNull(accountMemberDetails);
            Assert.True(accountMemberDetails.Success);
            if (accountMemberDetails.Errors != null)
            {
                Assert.Empty(accountMemberDetails.Errors);
            }
        }
Exemple #5
0
        public async Task TestGetAccountMembersAsync(int?page, int?perPage, OrderType?order)
        {
            using var client = new CloudFlareClient(Credentials.Credentials.Authentication);

            var accounts = await client.GetAccountsAsync();

            var accountMembers = await client.GetAccountMembersAsync(accounts.Result.First().Id, page, perPage, order);

            Assert.NotNull(accountMembers);
            Assert.True(accountMembers.Success);

            if (accountMembers.Errors != null)
            {
                Assert.Empty(accountMembers.Errors);
            }
        }