本文整理汇总了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);
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}