コード例 #1
0
        public static void CreateAddAndDelete()
        {
            OAuthTokens tokens = Configuration.GetTokens();

            string      testListIgnore = "test-list-ignore";
            TwitterUser myUser         = TwitterAccount.VerifyCredentials(tokens).ResponseObject;
            var         userIdToAdd    = TwitterUser.Show(tokens, userName).ResponseObject.Id;

            var listResponse = TwitterList.Show(tokens, testListIgnore);

            if (listResponse.Result == RequestResult.FileNotFound)
            {
                // Create the new list
                listResponse = TwitterList.New(tokens, myUser.ScreenName, testListIgnore, false, "Testing Twitterizer");
                Assert.That(listResponse.Result == RequestResult.Success);
            }

            // Add a user
            var addMemberResponse = TwitterList.AddMember(tokens, myUser.ScreenName, testListIgnore, userIdToAdd);

            Assert.That(addMemberResponse.Result == RequestResult.Success);

            // Remove the user
            var removeMemberResponse = TwitterList.RemoveMember(tokens, myUser.ScreenName, testListIgnore, userIdToAdd);

            Assert.That(removeMemberResponse.Result == RequestResult.Success);

            // Delete the list
            listResponse = TwitterList.Delete(tokens, myUser.ScreenName, testListIgnore, null);
            Assert.That(listResponse.Result == RequestResult.Success);
        }