Ejemplo n.º 1
0
 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));
 }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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());
        }
Ejemplo n.º 4
0
        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());
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        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"));
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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());
        }
Ejemplo n.º 9
0
        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));
        }
Ejemplo n.º 10
0
        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"));
        }