public async void GetItems() { string appId = "248058472262288"; string appSecret = "d74d68d717ff1a0c45dc3fbad0899d26"; string FacebookQueryParam = "625038207649339"; int MaxRecordsParam = 20; Items.Clear(); _facebookDataProvider = new FacebookDataProvider(new FacebookOAuthTokens { AppId = appId, AppSecret = appSecret }); var config = new FacebookDataConfig { UserId = FacebookQueryParam }; var items = await _facebookDataProvider.LoadDataAsync(config, MaxRecordsParam); foreach (var item in items) { if (item.ImageUrl == null || item.ImageUrl == "") { item.ImageUrl = "https://eclass.aueb.gr/courses/theme_data/9/eclass_aueb_logo.png"; } Items.Add(item); } pring.IsActive = false; pring.Visibility = Visibility.Collapsed; FeedFb.Visibility = Visibility.Visible; }
public override async Task <IEnumerable <FacebookSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new FacebookDataConfig { UserId = "222343777914236" }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
private async void Request() { try { IsBusy = true; HasErrors = false; NoItems = false; DataProviderRawData = string.Empty; Items.Clear(); var facebookDataProvider = new FacebookDataProvider(new FacebookOAuthTokens { AppId = AppId, AppSecret = AppSecret }); var config = new FacebookDataConfig { UserId = FacebookQueryParam }; var rawParser = new RawParser(); var rawData = await facebookDataProvider.LoadDataAsync(config, MaxRecordsParam, rawParser); DataProviderRawData = rawData.FirstOrDefault()?.Raw; var items = await facebookDataProvider.LoadDataAsync(config, MaxRecordsParam); NoItems = !items.Any(); foreach (var item in items) { Items.Add(item); } } catch (Exception ex) { DataProviderRawData += ex.Message; DataProviderRawData += ex.StackTrace; HasErrors = true; } finally { IsBusy = false; } }
public async Task TestRevokedOAuth() { var config = new FacebookDataConfig { UserId = "8195378771", }; var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookRevokedKeys); await ExceptionsAssert.ThrowsAsync<OAuthKeysRevokedException>(async () => await dataProvider.LoadDataAsync(config)); }
public async Task LoadFacebook() { var config = new FacebookDataConfig { UserId = "8195378771", }; var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookValidKeys); IEnumerable<FacebookSchema> result = await dataProvider.LoadDataAsync(config); Assert.IsNotNull(result); Assert.IsTrue(result.Any()); }
public async Task TestMaxRecords_Min() { int maxRecords = 1; var config = new FacebookDataConfig { UserId = "8195378771", }; var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookValidKeys); IEnumerable <FacebookSchema> result = await dataProvider.LoadDataAsync(config, maxRecords); Assert.AreEqual(maxRecords, result.Count()); }
public async Task LoadFacebook() { var config = new FacebookDataConfig { UserId = "8195378771", }; var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookValidKeys); IEnumerable <FacebookSchema> result = await dataProvider.LoadDataAsync(config); Assert.IsNotNull(result); Assert.IsTrue(result.Any()); }
public async Task TestMaxRecords() { int maxRecords = 70; var config = new FacebookDataConfig { UserId = "150135720497", }; var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookValidKeys); IEnumerable <FacebookSchema> result = await dataProvider.LoadDataAsync(config, maxRecords); Assert.IsTrue(result.Count() > 25); }
public async Task TestEmptyOAuth() { var config = new FacebookDataConfig { UserId = "8195378771", }; var dataProvider = new FacebookDataProvider(new FacebookOAuthTokens()); OAuthKeysNotPresentException exception = await ExceptionsAssert.ThrowsAsync<OAuthKeysNotPresentException>(async () => await dataProvider.LoadDataAsync(config)); Assert.IsTrue(exception.Message.Contains("AppId")); }
public async Task TestNullUserId() { var config = new FacebookDataConfig { UserId = null, }; var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookValidKeys); ConfigParameterNullException exception = await ExceptionsAssert.ThrowsAsync<ConfigParameterNullException>(async () => await dataProvider.LoadDataAsync(config)); Assert.IsTrue(exception.Message.Contains("UserId")); }
public async Task TestInvalidOAuth() { var config = new FacebookDataConfig { UserId = "8195378771", }; var tokens = new FacebookOAuthTokens { AppId = "INVALID", AppSecret = "INVALID" }; var dataProvider = new FacebookDataProvider(tokens); await ExceptionsAssert.ThrowsAsync<OAuthKeysRevokedException>(async () => await dataProvider.LoadDataAsync(config)); }
public async void GetItems() { string appId = "YourAppId"; string appSecret = "YourAppSecret"; string FacebookQueryParam = "8195378771"; int MaxRecordsParam = 20; Items.Clear(); _facebookDataProvider = new FacebookDataProvider(new FacebookOAuthTokens { AppId = appId, AppSecret = appSecret }); var config = new FacebookDataConfig { UserId = FacebookQueryParam }; var items = await _facebookDataProvider.LoadDataAsync(config, MaxRecordsParam); foreach (var item in items) { Items.Add(item); } }
public async void GetItems() { string appId = "YourAppId"; string appSecret = "YourAppSecret"; string FacebookQueryParam = "8195378771"; int MaxRecordsParam = 20; Items.Clear(); _facebookDataProvider = new FacebookDataProvider(new FacebookOAuthTokens { AppId = appId, AppSecret = appSecret }); var config = new FacebookDataConfig { UserId = FacebookQueryParam }; var items = await _facebookDataProvider.LoadDataAsync(config, MaxRecordsParam); foreach (var item in items) { Items.Add(item); } }
public async Task TestNullOAuth() { var config = new FacebookDataConfig { UserId = "8195378771", }; var dataProvider = new FacebookDataProvider(null); await ExceptionsAssert.ThrowsAsync <ConfigParameterNullException>(async() => await dataProvider.LoadDataAsync(config)); }
public async Task TestNullUserId() { var config = new FacebookDataConfig { UserId = null, }; var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookValidKeys); ConfigParameterNullException exception = await ExceptionsAssert.ThrowsAsync <ConfigParameterNullException>(async() => await dataProvider.LoadDataAsync(config)); Assert.IsTrue(exception.Message.Contains("UserId")); }
public async Task TestEmptyOAuth() { var config = new FacebookDataConfig { UserId = "8195378771", }; var dataProvider = new FacebookDataProvider(new FacebookOAuthTokens()); OAuthKeysNotPresentException exception = await ExceptionsAssert.ThrowsAsync <OAuthKeysNotPresentException>(async() => await dataProvider.LoadDataAsync(config)); Assert.IsTrue(exception.Message.Contains("AppId")); }
public async Task TestInvalidOAuth() { var config = new FacebookDataConfig { UserId = "8195378771", }; var tokens = new FacebookOAuthTokens { AppId = "INVALID", AppSecret = "INVALID" }; var dataProvider = new FacebookDataProvider(tokens); await ExceptionsAssert.ThrowsAsync <OAuthKeysRevokedException>(async() => await dataProvider.LoadDataAsync(config)); }
public async Task TestRevokedOAuth() { var config = new FacebookDataConfig { UserId = "8195378771", }; var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookRevokedKeys); await ExceptionsAssert.ThrowsAsync <OAuthKeysRevokedException>(async() => await dataProvider.LoadDataAsync(config)); }
public async Task TestNullParser() { var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookValidKeys); await ExceptionsAssert.ThrowsAsync<ParserNullException>(async () => await dataProvider.LoadDataAsync<FacebookSchema>(new FacebookDataConfig(), 20, null)); }
public async Task TestNullConfig() { var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookValidKeys); await ExceptionsAssert.ThrowsAsync<ConfigNullException>(async () => await dataProvider.LoadDataAsync(null)); }
public async Task TestNullParser() { var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookValidKeys); await ExceptionsAssert.ThrowsAsync <ParserNullException>(async() => await dataProvider.LoadDataAsync <FacebookSchema>(new FacebookDataConfig(), 20, null)); }
public async Task TestNullConfig() { var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookValidKeys); await ExceptionsAssert.ThrowsAsync <ConfigNullException>(async() => await dataProvider.LoadDataAsync(null)); }
public async Task TestMaxRecords_Min() { int maxRecords = 1; var config = new FacebookDataConfig { UserId = "8195378771", }; var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookValidKeys); IEnumerable<FacebookSchema> result = await dataProvider.LoadDataAsync(config, maxRecords); Assert.AreEqual(maxRecords, result.Count()); }
public async Task TestNullOAuth() { var config = new FacebookDataConfig { UserId = "8195378771", }; var dataProvider = new FacebookDataProvider(null); await ExceptionsAssert.ThrowsAsync<ConfigParameterNullException>(async () => await dataProvider.LoadDataAsync(config)); }
public async Task TestMaxRecords() { int maxRecords = 70; var config = new FacebookDataConfig { UserId = "150135720497", }; var dataProvider = new FacebookDataProvider(OAuthKeys.FacebookValidKeys); IEnumerable<FacebookSchema> result = await dataProvider.LoadDataAsync(config, maxRecords); Assert.IsTrue(result.Count() > 25); }