本文整理汇总了C#中TwitterService.GetAccountSettings方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterService.GetAccountSettings方法的具体用法?C# TwitterService.GetAccountSettings怎么用?C# TwitterService.GetAccountSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TwitterService
的用法示例。
在下文中一共展示了TwitterService.GetAccountSettings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_update_account_settings
public void Can_update_account_settings()
{
var service = new TwitterService(_consumerKey, _consumerSecret);
service.AuthenticateWith(_accessToken, _accessTokenSecret);
var original = service.GetAccountSettings();
var state = !original.SleepTime.Enabled.Value;
Trace.WriteLine("Sleep state was " + original.SleepTime.Enabled);
var updated = service.UpdateAccountSettings(state);
Assert.AreEqual(state, updated.SleepTime.Enabled);
Trace.WriteLine("Sleep state is now " + updated.SleepTime.Enabled);
updated = service.UpdateAccountSettings(!state);
Assert.AreEqual(!state, updated.SleepTime.Enabled);
Trace.WriteLine("Sleep state is now " + updated.SleepTime.Enabled);
}
示例2: Can_return_results_from_account_settings_endpoint
public void Can_return_results_from_account_settings_endpoint()
{
//{"protected":false,
//"geo_enabled":false,
//"trend_location":[{"countryCode":"CA","name":"Canada","country":"Canada","placeType":{"name":"Country","code":12},"woeid":23424775,"url":"http:\/\/where.yahooapis.com\/v1\/place\/23424775","parentid":1}],
//"language":"en",
//"sleep_time":{"start_time":0,"end_time":12,"enabled":true},
//"always_use_https":false,
//"screen_name":"danielcrenna",
//"show_all_inline_media":false,
//"time_zone":{"name":"Eastern Time (US & Canada)","utc_offset":-18000,"tzinfo_name":"America\/New_York"},
//"discoverable_by_email":true}
var service = new TwitterService(_consumerKey, _consumerSecret);
service.AuthenticateWith(_accessToken, _accessTokenSecret);
var account = service.GetAccountSettings();
Console.WriteLine(account.RawSource);
Assert.AreEqual(false, account.IsProtected);
Assert.AreEqual(true, account.GeoEnabled);
Assert.IsNotNull(account.TrendLocations);
Assert.AreEqual(1, account.TrendLocations.Count());
Assert.AreEqual("CA", account.TrendLocations.Single().CountryCode);
Assert.AreEqual("Canada", account.TrendLocations.Single().Name);
Assert.AreEqual("Canada", account.TrendLocations.Single().Country);
Assert.AreEqual("en", account.Language);
Assert.AreEqual("danielcrenna", account.ScreenName);
Assert.AreEqual(true, account.ShowAllInlineMedia);
Assert.IsNotNull(account.TimeZone);
Assert.AreEqual("Eastern Time (US & Canada)", account.TimeZone.Name);
Assert.AreEqual(-18000, account.TimeZone.UtcOffset);
Assert.AreEqual("America/New_York", account.TimeZone.InfoName);
Assert.IsNotNull(account.SleepTime);
Assert.AreEqual(0, account.SleepTime.StartTime, "start_time");
Assert.AreEqual(12, account.SleepTime.EndTime, "end_time");
Assert.AreEqual(true, account.SleepTime.Enabled);
}