コード例 #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));
 }
コード例 #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));
        }
コード例 #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());
        }
コード例 #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());
        }
コード例 #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));
        }
コード例 #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"));
        }
コード例 #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);
        }
コード例 #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());
        }
コード例 #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));
        }
コード例 #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"));
        }