当前位置: 首页>>代码示例>>C#>>正文


C# IUserSession.GetVerifyCredentials方法代码示例

本文整理汇总了C#中IUserSession.GetVerifyCredentials方法的典型用法代码示例。如果您正苦于以下问题:C# IUserSession.GetVerifyCredentials方法的具体用法?C# IUserSession.GetVerifyCredentials怎么用?C# IUserSession.GetVerifyCredentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IUserSession的用法示例。


在下文中一共展示了IUserSession.GetVerifyCredentials方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoUserAccountTest

        public async Task<bool> DoUserAccountTest(IUserSession session, List<int> testSeq)
        {
            var successStatus = true;
            try
            {
                // 1
                if (testSeq.Contains(1))
                {
                    ConsoleOutput.PrintMessage("1.1 UsersExtensions\\GetAccountSettings", ConsoleColor.Gray);
                    var accountSettings = await session.GetAccountSettings();
                    testScreenName = accountSettings.ScreenName;
                    if (accountSettings.OK && !string.IsNullOrWhiteSpace(testScreenName))
                    {
                        ConsoleOutput.PrintMessage(String.Format("Screen Name: {0}", testScreenName));
                        ConsoleOutput.PrintMessage(String.Format("Time Zone: {0}", accountSettings.TimeZone.name));
                        ConsoleOutput.PrintMessage(String.Format("Trend Location: {0}",
                            accountSettings.TrendLocation.ToList()[0].name));
                    }
                    else
                        successStatus = false;
                }
                // 2
                if (testSeq.Contains(2))
                {
                    ConsoleOutput.PrintMessage("1.2 UsersExtensions\\GetVerifyCredentials", ConsoleColor.Gray);
                    loggedInUserProfile = await session.GetVerifyCredentials();
                    if (loggedInUserProfile.OK)
                    {
                        ConsoleOutput.PrintMessage("Credentials Verified OK.");
                        ConsoleOutput.PrintMessage(String.Format("User ID Verified OK: {0}", loggedInUserProfile.UserId));
                    }
                    else
                        successStatus = false;
                }
                // 3
                if (testSeq.Contains(3))
                {
                    ConsoleOutput.PrintMessage("1.3 UsersExtensions\\GetUserProfile", ConsoleColor.Gray);
                    var getProfile = await session.GetUserProfile(testScreenName);
                    if (getProfile.OK)
                    {
                        ConsoleOutput.PrintMessage(String.Format("Name: {0}", getProfile.Name));
                        ConsoleOutput.PrintMessage(String.Format("User ID: {0}", getProfile.UserId));
                        ConsoleOutput.PrintMessage(String.Format("Avatar URL: {0}", getProfile.Avatar));
                        ConsoleOutput.PrintMessage(String.Format("Followers: {0}", getProfile.Followers));
                        ConsoleOutput.PrintMessage(String.Format("Friends: {0}", getProfile.Friends));
                        ConsoleOutput.PrintMessage(String.Format("Description: {0}", getProfile.Description));
                    }
                    else
                        successStatus = false;
                }
                // 4
                if (testSeq.Contains(4))
                {
                    ConsoleOutput.PrintMessage("1.4 UsersExtensions\\ChangeAccountSettings", ConsoleColor.Gray);
                    var changeSettings = await session.ChangeAccountSettings(trendLocationWoeid: "1");
                    if (changeSettings.OK)
                    {
                        ConsoleOutput.PrintMessage(String.Format("Trend Location: {0}",
                            changeSettings.TrendLocation.ToList()[0].name));
                    }
                    else
                        successStatus = false;
                }
                // 5
                if (testSeq.Contains(5))
                {
                    ConsoleOutput.PrintMessage("1.5 UsersExtensions\\GetBlockList - Cursored", ConsoleColor.Gray);
                    long nextcursor = -1;
                    var blockListCount = 0;

                    do
                    {
                        var blockList = await session.GetBlockList(cursor: nextcursor);
                        if (blockList.twitterFaulted) continue;
                        nextcursor = blockList.next_cursor;
                        ConsoleOutput.PrintMessage(String.Format("Previous cursor: {0} Next cursor: {1}",
                            blockList.previous_cursor, blockList.next_cursor));
                        foreach (var l in blockList.users)
                        {
                            blockListCount++;
                            ConsoleOutput.PrintMessage(String.Format("ScreenName: {0} User ID: {1} Description: {2}",
                                l.Name, l.UserId, l.Description));
                        }
                    } while (nextcursor != 0);

                    ConsoleOutput.PrintMessage(String.Format("Block List Count: {0}",
                        blockListCount));
                }
                // 6
                if (testSeq.Contains(6))
                {
                    ConsoleOutput.PrintMessage("1.6 UsersExtensions\\DeleteUserBlock", ConsoleColor.Gray);
                    var deleteUserBlock = await session.DeleteUserBlock(screenName: "NickHodgeMSFT");
                    if (deleteUserBlock.OK)
                        ConsoleOutput.PrintMessage(String.Format("ScreenName: {0}", deleteUserBlock.ScreenName));
                    else
                        successStatus = false;
                }
                // 7
//.........这里部分代码省略.........
开发者ID:nickhodge,项目名称:BoxKite.Twitter,代码行数:101,代码来源:01UserAccountLiveFireTests.cs


注:本文中的IUserSession.GetVerifyCredentials方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。