public async Task LoadInstagramInvalidUserId() { var config = new InstagramDataConfig { QueryType = InstagramQueryType.Id, Query = "-1234" }; var dataProvider = new InstagramDataProvider(OAuthKeys.InstagramValidKeys); await ExceptionsAssert.ThrowsAsync<RequestFailedException>(async () => await dataProvider.LoadDataAsync(config)); }
public async Task TestRevokedOAuth() { var config = new InstagramDataConfig { QueryType = InstagramQueryType.Tag, Query = "windowsappstudio" }; var dataProvider = new InstagramDataProvider(OAuthKeys.InstagramRevokedKeys); await ExceptionsAssert.ThrowsAsync<OAuthKeysRevokedException>(async () => await dataProvider.LoadDataAsync(config)); }
public async Task LoadInstagramValidUserId() { var config = new InstagramDataConfig { QueryType = InstagramQueryType.Id, Query = "239684951" }; var dataProvider = new InstagramDataProvider(OAuthKeys.InstagramValidKeys); IEnumerable<InstagramSchema> result = await dataProvider.LoadDataAsync(config); Assert.IsNotNull(result); Assert.IsTrue(result.Any()); }
public async Task LoadInstagramTags() { var config = new InstagramDataConfig { QueryType = InstagramQueryType.Tag, Query = "windowsappstudio" }; var dataProvider = new InstagramDataProvider(OAuthKeys.InstagramValidKeys); IEnumerable<InstagramSchema> result = await dataProvider.LoadDataAsync(config); Assert.IsNotNull(result); Assert.IsTrue(result.Any()); }
public async Task TestInvalidOAuth() { var config = new InstagramDataConfig { QueryType = InstagramQueryType.Tag, Query = "windowsappstudio" }; var tokens = new InstagramOAuthTokens { ClientId = "INVALID" }; var dataProvider = new InstagramDataProvider(tokens); await ExceptionsAssert.ThrowsAsync<OAuthKeysRevokedException>(async () => await dataProvider.LoadDataAsync(config)); }
public async Task TestEmptyOAuth() { var config = new InstagramDataConfig { QueryType = InstagramQueryType.Tag, Query = "windowsappstudio" }; var dataProvider = new InstagramDataProvider(new InstagramOAuthTokens()); OAuthKeysNotPresentException exception = await ExceptionsAssert.ThrowsAsync<OAuthKeysNotPresentException>(async () => await dataProvider.LoadDataAsync(config)); Assert.IsTrue(exception.Message.Contains("ClientId")); }
public async Task TestMaxRecordsUserId() { int maxRecords = 30; var config = new InstagramDataConfig { QueryType = InstagramQueryType.Id, Query = "239684951" }; var dataProvider = new InstagramDataProvider(OAuthKeys.InstagramValidKeys); IEnumerable<InstagramSchema> result = await dataProvider.LoadDataAsync(config, maxRecords); Assert.IsTrue(result.Count() > 20); }
public async Task TestMaxRecordsTags_Min() { int maxRecords = 1; var config = new InstagramDataConfig { QueryType = InstagramQueryType.Tag, Query = "windowsappstudio" }; var dataProvider = new InstagramDataProvider(OAuthKeys.InstagramValidKeys); IEnumerable<InstagramSchema> result = await dataProvider.LoadDataAsync(config, maxRecords); Assert.AreEqual(maxRecords, result.Count()); }
public async Task TestNullOAuth() { var config = new InstagramDataConfig { QueryType = InstagramQueryType.Tag, Query = "windowsappstudio" }; var dataProvider = new InstagramDataProvider(null); await ExceptionsAssert.ThrowsAsync<ConfigParameterNullException>(async () => await dataProvider.LoadDataAsync(config)); }
public async Task TestNullQuery() { var config = new InstagramDataConfig { QueryType = InstagramQueryType.Tag, Query = null }; var dataProvider = new InstagramDataProvider(OAuthKeys.InstagramValidKeys); ConfigParameterNullException exception = await ExceptionsAssert.ThrowsAsync<ConfigParameterNullException>(async () => await dataProvider.LoadDataAsync(config)); Assert.IsTrue(exception.Message.Contains("Query")); }