public void CreateAsync_ShouldAddNewNewCommentToDefaultTask() { var newComment = new WrikeTaskComment("My new test comment", DefaultTaskId); var createdComment = WrikeClientFactory.GetWrikeClient().Comments.CreateAsync(newComment, plainText: true).Result; Assert.IsNotNull(createdComment); Assert.AreEqual(newComment.Text, createdComment.Text); Assert.AreEqual(newComment.TaskId, createdComment.TaskId); }
public void GetInTaskAsync_ShouldReturnComments() { var newComment = new WrikeTaskComment("My new test comment", DefaultTaskId); var createdComment = WrikeClientFactory.GetWrikeClient().Comments.CreateAsync(newComment, plainText: true).Result; var comments = WrikeClientFactory.GetWrikeClient().Comments.GetInTaskAsync(DefaultTaskId).Result; Assert.IsNotNull(comments); Assert.Greater(comments.Count, 0); Assert.IsTrue(comments.Any(c => c.Id == createdComment.Id)); }
public void UpdateAsync_ShouldUpdateCommentText() { var newComment = new WrikeTaskComment("My new test comment", DefaultTaskId); newComment = WrikeClientFactory.GetWrikeClient().Comments.CreateAsync(newComment, plainText: true).Result; var expectedCommentText = "My new test comment [Updated]"; var updatedComment = WrikeClientFactory.GetWrikeClient().Comments.UpdateAsync(newComment.Id, expectedCommentText, plainText: true).Result; Assert.IsNotNull(updatedComment); Assert.AreEqual(expectedCommentText, updatedComment.Text); }
public void DeleteAsync_ShouldDeleteComment() { var newComment = new WrikeTaskComment("My new test comment", DefaultTaskId); newComment = WrikeClientFactory.GetWrikeClient().Comments.CreateAsync(newComment, plainText: true).Result; WrikeClientFactory.GetWrikeClient().Comments.DeleteAsync(newComment.Id).Wait(); var comments = WrikeClientFactory.GetWrikeClient().Comments.GetAsync().Result; var isCommentDeleted = !comments.Any(c => c.Id == newComment.Id); Assert.IsTrue(isCommentDeleted); }
public static async Task Run(WrikeClient client) { var tasks = await client.Tasks.GetAsync(); var specialTask = tasks.FirstOrDefault(t => t.Permalink.Contains("273185186")); var newComment = new WrikeTaskComment("test comment #1", specialTask.Id); var comments = await client.Comments.GetAsync(); newComment = await client.Comments.CreateAsync(newComment, true); var updatedComment = await client.Comments.UpdateAsync(newComment.Id, "updated comment #1", true); comments = await client.Comments.GetAsync(new List <string> { newComment.Id }); await client.Comments.DeleteAsync(newComment.Id); }