Example #1
0
        public async Task ListAsync_Test()
        {
            /* arrange */

            string testEmail = "*****@*****.**";

            var addBlacklistEntryRequest = DisqusBlacklistAddRequest
                                           .New(TestData.Forum)
                                           .Email(testEmail);

            await Disqus.Blacklists.AddAsync(DisqusAccessToken.Create(TestData.AccessToken), addBlacklistEntryRequest).ConfigureAwait(false);

            var request = DisqusBlacklistListRequest
                          .New(TestData.Forum)
                          .Related(DisqusBlacklistEntryRelated.Forum);

            /* act */

            var response = await Disqus.Blacklists.ListAsync(DisqusAccessToken.Create(TestData.AccessToken), request).ConfigureAwait(false);

            /* assert */

            Assert.That(response, Is.Not.Null);
            Assert.That(response.Code, Is.EqualTo(DisqusApiResponseCode.Success));
            Assert.That(response.Response, Is.Not.Empty);

            /* teardown */

            var removeBlacklistEntryRequest = DisqusBlacklistRemoveRequest
                                              .New(TestData.Forum)
                                              .Email(testEmail);

            await Disqus.Blacklists.RemoveAsync(DisqusAccessToken.Create(TestData.AccessToken), removeBlacklistEntryRequest).ConfigureAwait(false);
        }
Example #2
0
        public async Task AddAsync_Test()
        {
            /* arrange */

            string testEmail = string.Format("{0}@test.test", Guid.NewGuid().ToString("N"));

            var request = DisqusBlacklistAddRequest
                          .New(TestData.Forum)
                          .Email(testEmail);

            /* act */

            var response = await Disqus.Blacklists.AddAsync(DisqusAccessToken.Create(TestData.AccessToken), request).ConfigureAwait(false);

            /* assert */

            Assert.That(response, Is.Not.Null);
            Assert.That(response.Code, Is.EqualTo(DisqusApiResponseCode.Success));
            Assert.That(response.Response, Is.Not.Empty);
            Assert.That(response.Response.First().Value, Is.EqualTo(testEmail));
        }
Example #3
0
        public async Task <DisqusResponse <IEnumerable <DisqusBlacklistEntry> > > AddAsync(DisqusAccessToken accessToken,
                                                                                           DisqusBlacklistAddRequest request)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithMultipleParameters(request.Parameters)
                                                                     .WithOptionalParameter("access_token", accessToken);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <IEnumerable <DisqusBlacklistEntry> > >(DisqusRequestMethod.Post,
                                                                                         DisqusEndpoints.Blacklists.Add, parameters)
                   .ConfigureAwait(false));
        }