public async Task ListAsync_Test() { /* arrange */ string testEmail = "*****@*****.**"; var addWhitelistEntryRequest = DisqusWhitelistAddRequest .New(TestData.Forum) .Email(testEmail); await Disqus.Whitelists.AddAsync(DisqusAccessToken.Create(TestData.AccessToken), addWhitelistEntryRequest).ConfigureAwait(false); var request = DisqusWhitelistListRequest .New(TestData.Forum) .Related(DisqusWhitelistEntryRelated.Forum); /* act */ var response = await Disqus.Whitelists.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 removeWhitelistEntryRequest = DisqusWhitelistRemoveRequest .New(TestData.Forum) .Email(testEmail); await Disqus.Whitelists.RemoveAsync(DisqusAccessToken.Create(TestData.AccessToken), removeWhitelistEntryRequest).ConfigureAwait(false); }
public async Task AddAsync_Test() { /* arrange */ string testEmail = string.Format("{0}@test.test", Guid.NewGuid().ToString("N")); var request = DisqusWhitelistAddRequest .New(TestData.Forum) .Email(testEmail); /* act */ var response = await Disqus.Whitelists.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)); }
public async Task <DisqusResponse <IEnumerable <DisqusWhitelistEntry> > > AddAsync(DisqusAccessToken accessToken, DisqusWhitelistAddRequest request) { Collection <KeyValuePair <string, string> > parameters = Parameters .WithMultipleParameters(request.Parameters) .WithOptionalParameter("access_token", accessToken); return(await RequestProcessor .ExecuteAsync <DisqusResponse <IEnumerable <DisqusWhitelistEntry> > >(DisqusRequestMethod.Post, DisqusEndpoints.Whitelists.Add, parameters) .ConfigureAwait(false)); }