public async Task WatchingTestAsync() { var issueTypes = await client.GetIssueTypesAsync(projectId); var issue = await client.CreateIssueAsync(new CreateIssueParams(projectId, "WatchingTestIssue", issueTypes.First().Id, IssuePriorityType.High)); var watch = await client.AddWatchToIssueAsync(issue.Id, "Note"); Assert.AreNotEqual(watch.Id, 0); Assert.AreEqual(watch.Issue.Id, issue.Id); Assert.AreEqual(watch.Note, "Note"); Assert.IsNotNull(watch.Created); Assert.IsNotNull(watch.Updated); await client.MarkAsCheckedUserWatchesAsync(ownUser.Id); var watchGet = await client.GetWatchAsync(watch.Id); Assert.AreEqual(watchGet.Id, watch.Id); Assert.AreEqual(watchGet.Note, watch.Note); Assert.AreEqual(watchGet.Issue.Id, watch.Issue.Id); var watchUpdated = await client.UpdateWatchAsync(new UpdateWatchParams(watch.Id) { Note = "NoteUpdated" }); Assert.AreEqual(watchUpdated.Id, watch.Id); Assert.AreEqual(watchUpdated.Note, "NoteUpdated"); var watchDeleted = await client.DeleteWatchAsync(watch.Id); Assert.AreEqual(watchDeleted.Id, watchUpdated.Id); Assert.AreEqual(watchDeleted.Note, watchUpdated.Note); await client.DeleteIssueAsync(issue.Id); }
public async Task UserWatchsAndCountTestAsync() { var ownuser = await client.GetMyselfAsync(); await client.GetUserWatchCountAsync(ownuser.Id, new GetWatchCountParams() { AlreadyRead = true }); await client.GetUserWatchCountAsync(ownuser.Id, new GetWatchCountParams() { ResourceAlreadyRead = true }); var issueTypes = await client.GetIssueTypesAsync(projectId); var issue = await client.CreateIssueAsync(new CreateIssueParams(projectId, "WatchingTestIssue", issueTypes.First().Id, IssuePriorityType.High)); var watch = await client.AddWatchToIssueAsync(issue.Id, "Note"); var count = await client.GetUserWatchCountAsync(ownuser.Id); Assert.AreNotEqual(count, 0); var watches = await client.GetUserWatchesAsync(ownuser.Id, new GetWatchesParams() { Count = 100, ResourceAlreadyRead = true, Sort = GetWatchsSortKey.Created, Order = Order.Asc, IssueIds = new[] { issue.Id } }); //Assert.IsTrue(watches.Any(x => x.Issue.Id == issue.Id)); await client.DeleteIssueAsync(issue.Id); }