Exemplo n.º 1
0
        public DisqusThreadListRequest Attach(DisqusThreadAttach attach)
        {
            if (attach == DisqusThreadAttach.None)
            {
                return(this);
            }

            var parameters = attach.ToStringArray().Select(a => new KeyValuePair <string, string>("attach", a));

            Parameters.AddRange(parameters);

            return(this);
        }
Exemplo n.º 2
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);
            }
        }