示例#1
0
        public async Task DetailsAsync_Test(string threadId, DisqusThreadRelated related, DisqusThreadAttach attach)
        {
            /* arrange */

            var request = DisqusThreadDetailsRequest
                          .New(DisqusThreadLookupType.Id, threadId)
                          .Related(related)
                          .Attach(attach);

            /* act */

            var response = await Disqus.Threads.DetailsAsync(request).ConfigureAwait(false);

            /* assert */

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

            if (related.HasFlag(DisqusThreadRelated.Category))
            {
                Assert.That(response.Response.Category.Id, Is.Not.EqualTo(0));
                Assert.That(response.Response.Category.Title, Is.Not.Null);
            }

            if (related.HasFlag(DisqusThreadRelated.Author))
            {
                Assert.That(response.Response.Author.Id, Is.Not.EqualTo(0));
            }

            if (related.HasFlag(DisqusThreadRelated.Forum))
            {
                Assert.That(response.Response.Forum.Id, Is.Not.Null);
            }
        }
示例#2
0
        public async Task <DisqusResponse <DisqusThread> > DetailsAsync(DisqusAccessToken accessToken,
                                                                        DisqusThreadDetailsRequest request)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithOptionalParameter("access_token", accessToken)
                                                                     .WithMultipleParameters(request.Parameters);

            var response = await RequestProcessor
                           .ExecuteAsync <DisqusResponse <DisqusThread> >(DisqusRequestMethod.Get, DisqusEndpoints.Threads.Details,
                                                                          parameters)
                           .ConfigureAwait(false);

            return(response);
        }
 public async Task <DisqusResponse <DisqusThread> > DetailsAsync(DisqusThreadDetailsRequest request)
 {
     return(await DetailsAsync(null, request).ConfigureAwait(false));
 }