public async Task RemoveModeratorAsync_ByUserName_Test() { /* arrange */ var addModeratorRequest = DisqusForumAddModeratorRequest .New(TestData.Forum, TestData.ModeratorUserName); var moderator = await Disqus.Forums .AddModeratorAsync(DisqusAccessToken.Create(TestData.AccessToken), addModeratorRequest) .ConfigureAwait(false); var request = DisqusForumRemoveModeratorRequest .New() .User(moderator.Response.User.Username); /* act */ var response = await Disqus.Forums .RemoveModeratorAsync(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.Id, Is.Null); }
public async Task AddModeratorAsync_ByUsername_Test() { /* arrange */ bool canAdminister = true; bool canEdit = true; var request = DisqusForumAddModeratorRequest .New(TestData.Forum, TestData.UserName) .CanAdminister(canAdminister) .CanEdit(canEdit); /* act */ var response = await Disqus.Forums .AddModeratorAsync(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.Null); Assert.That(response.Response.User.Username, Is.EqualTo(TestData.UserName)); }
public async Task <DisqusResponse <DisqusForumModerator> > AddModeratorAsync(DisqusAccessToken accessToken, DisqusForumAddModeratorRequest request) { Collection <KeyValuePair <string, string> > parameters = Parameters .WithParameter("access_token", accessToken) .WithMultipleParameters(request.Parameters); return(await RequestProcessor .ExecuteAsync <DisqusResponse <DisqusForumModerator> >(DisqusRequestMethod.Post, DisqusEndpoints.Forums.AddModerator, parameters) .ConfigureAwait(false)); }