本文整理汇总了C#中IUserSession.CreateFavourite方法的典型用法代码示例。如果您正苦于以下问题:C# IUserSession.CreateFavourite方法的具体用法?C# IUserSession.CreateFavourite怎么用?C# IUserSession.CreateFavourite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUserSession
的用法示例。
在下文中一共展示了IUserSession.CreateFavourite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoFavouritesTest
public async Task<bool> DoFavouritesTest(IUserSession session, List<int> testSeq)
{
var successStatus = true;
try
{
// 1
if (testSeq.Contains(1))
{
ConsoleOutput.PrintMessage("5.1 Favourites\\GetFavourites", ConsoleColor.Gray);
var favourites1 = await session.GetFavourites(count:50);
if (favourites1.OK)
{
foreach (var t in favourites1)
{
ConsoleOutput.PrintMessage(
String.Format("From: {0} // Message: {1}", t.User.ScreenName, t.Text));
}
}
else
successStatus = false;
}
// 2
if (testSeq.Contains(2))
{
ConsoleOutput.PrintMessage("4.2 Favourites\\CreateFavourite", ConsoleColor.Gray);
var tweettofav = await session.GetTweet(336452534531137537);
var favourites2 = await session.CreateFavourite(tweettofav);
if (favourites2.OK)
{
ConsoleOutput.PrintMessage(
String.Format("From: {0} // Favourited Status: {1}", favourites2.User.ScreenName, favourites2.Favourited));
}
else
successStatus = false;
}
// 3
if (testSeq.Contains(3))
{
ConsoleOutput.PrintMessage("4.3 Favourites\\DeleteFavourite", ConsoleColor.Gray);
var tweettofav = await session.GetTweet(336452534531137537);
var favourites3 = await session.DeleteFavourite(tweettofav);
if (favourites3.OK)
{
ConsoleOutput.PrintMessage(
String.Format("From: {0} // Favourited Status: {1}", favourites3.User.ScreenName, favourites3.Favourited));
}
else
successStatus = false;
}
}
catch (Exception e)
{
ConsoleOutput.PrintError(e.ToString());
return false;
}
return successStatus;
}