本文整理汇总了C#中LinqToTwitter.TwitterContext.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterContext.Execute方法的具体用法?C# TwitterContext.Execute怎么用?C# TwitterContext.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinqToTwitter.TwitterContext
的用法示例。
在下文中一共展示了TwitterContext.Execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute_Calls_QueryTwitterStream_For_UserStream_Queries
public void Execute_Calls_QueryTwitterStream_For_UserStream_Queries()
{
var authMock = new Mock<ITwitterAuthorizer>();
var execMock = new Mock<ITwitterExecute>();
execMock.SetupGet(exec => exec.AuthorizedClient).Returns(authMock.Object);
var ctx = new TwitterContext(execMock.Object);
var streamingQuery =
from tweet in ctx.UserStream
where tweet.Type == UserStreamType.User
select tweet;
ctx.Execute<UserStream>(streamingQuery.Expression, isEnumerable: true);
execMock.Verify(exec => exec.QueryTwitterStream(It.IsAny<Request>()), Times.Once());
}
示例2: Execute_Calls_QueryTwitter_InsteadOf_QueryTwitterStream_For_NonStreaming_Queries
public void Execute_Calls_QueryTwitter_InsteadOf_QueryTwitterStream_For_NonStreaming_Queries()
{
var authMock = new Mock<ITwitterAuthorizer>();
var execMock = new Mock<ITwitterExecute>();
execMock.SetupGet(exec => exec.AuthorizedClient).Returns(authMock.Object);
execMock.Setup(exec => exec.QueryTwitter(It.IsAny<Request>(), It.IsAny<StatusRequestProcessor<Status>>())).Returns(SingleStatusResponse);
var ctx = new TwitterContext(execMock.Object);
var statusQuery =
from tweet in ctx.Status
where tweet.Type == StatusType.Show
select tweet;
ctx.Execute<Status>(statusQuery.Expression, isEnumerable: true);
execMock.Verify(exec => exec.QueryTwitterStream(It.IsAny<Request>()), Times.Never());
execMock.Verify(exec => exec.QueryTwitter(It.IsAny<Request>(), It.IsAny<StatusRequestProcessor<Status>>()), Times.Once());
}