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


C# TwitterContext.ExecuteRaw方法代码示例

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


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

示例1: CreateFavoriteDemo

        /// <summary>
        /// Perform create favorite side-effect with raw data
        /// </summary>
        /// <param name="twitterCtx">TwitterContext</param>
        private static void CreateFavoriteDemo(TwitterContext twitterCtx)
        {
            string status = "Testing LINQ to Twitter Raw Interface: " + DateTime.Now.ToString();
            var parameters = new Dictionary<string, string>();

            string queryString = "/favorites/create/25786742388.json";

            string result = twitterCtx.ExecuteRaw(queryString, parameters);

            Console.WriteLine("Result from create favorite: \n\n" + result);
        }
开发者ID:CheyPMK,项目名称:linqtotwitter,代码行数:15,代码来源:RawDemos.cs

示例2: ExecuteRawRequest_Resolves_Too_Few_Url_Slashes

        public void ExecuteRawRequest_Resolves_Too_Few_Url_Slashes()
        {
            const string BaseUrlWithoutTrailingSlash = "https://api.twitter.com/1.1/";
            const string QueryStringWithoutBeginningSlash = "statuses/update.json";
            const string FullUrl = "https://api.twitter.com/1.1/statuses/update.json";
            var authMock = new Mock<ITwitterAuthorizer>();
            var execMock = new Mock<ITwitterExecute>();
            execMock.SetupGet(exec => exec.AuthorizedClient).Returns(authMock.Object);
            var ctx = new TwitterContext(authMock.Object, execMock.Object, BaseUrlWithoutTrailingSlash, "");
            var parameters = new Dictionary<string, string>
            {
                { "status", "Testing" }
            };

            ctx.ExecuteRaw(QueryStringWithoutBeginningSlash, parameters);

            execMock.Verify(exec =>
                exec.PostToTwitter(
                    FullUrl,
                    parameters, It.IsAny<Func<string, Raw>>()), Times.Once());
        }
开发者ID:CheyPMK,项目名称:linqtotwitter,代码行数:21,代码来源:RawExtensionsTests.cs

示例3: ExecuteRawRequest_Invokes_Executor_Execute

        public void ExecuteRawRequest_Invokes_Executor_Execute()
        {
            var authMock = new Mock<ITwitterAuthorizer>();
            var execMock = new Mock<ITwitterExecute>();
            execMock.SetupGet(exec => exec.AuthorizedClient).Returns(authMock.Object);
            var ctx = new TwitterContext(authMock.Object, execMock.Object, "", "");
            const string QueryString = "statuses/update.json";
            var parameters = new Dictionary<string, string>
            {
                { "status", "Testing" }
            };

            ctx.ExecuteRaw(QueryString, parameters);

            execMock.Verify(exec =>
                exec.PostToTwitter(
                    "https://api.twitter.com/1.1/statuses/update.json",
                    parameters,
                    It.IsAny<Func<string, Raw>>()),
                Times.Once());
        }
开发者ID:CheyPMK,项目名称:linqtotwitter,代码行数:21,代码来源:RawExtensionsTests.cs

示例4: UpdateStatusDemo

        /// <summary>
        /// Perform update status side-effect with raw data
        /// </summary>
        /// <param name="twitterCtx">TwitterContext</param>
        private static void UpdateStatusDemo(TwitterContext twitterCtx)
        {
            string status = "Testing LINQ to Twitter Raw Interface: " + DateTime.Now.ToString();
            var parameters = new Dictionary<string, string>
            {
                { "status", status }
            };

            string queryString = "/statuses/update.json";

            string result = twitterCtx.ExecuteRaw(queryString, parameters);

            Console.WriteLine("Result from update status: \n\n" + result);
        }
开发者ID:CheyPMK,项目名称:linqtotwitter,代码行数:18,代码来源:RawDemos.cs

示例5: ExecuteRawRequest_Returns_Raw_Result

        public void ExecuteRawRequest_Returns_Raw_Result()
        {
            var authMock = new Mock<ITwitterAuthorizer>();
            var execMock = new Mock<ITwitterExecute>();
            execMock.SetupGet(exec => exec.AuthorizedClient).Returns(authMock.Object);
            var ctx = new TwitterContext(authMock.Object, execMock.Object, "", "");
            const string QueryString = "statuses/update.json";
            var parameters = new Dictionary<string, string>
            {
                { "status", "Testing" }
            };
            const string ExpectedResult = "<status>xxx</status>";
            const string FullUrl = "https://api.twitter.com/1.1/statuses/update.json";
            execMock.Setup(exec => exec.PostToTwitter(FullUrl, parameters, It.IsAny<Func<string, Raw>>())).Returns(ExpectedResult);

            string actualResult = ctx.ExecuteRaw(QueryString, parameters);

            Assert.Equal(ExpectedResult, actualResult);
        }
开发者ID:CheyPMK,项目名称:linqtotwitter,代码行数:19,代码来源:RawExtensionsTests.cs


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