public async Task NotificationTestAsync() { var conf = new BacklogJpConfigure(generalConfig.SpaceKey); conf.ApiKey = generalConfig.ApiKey2; var client2 = new BacklogClientFactory(conf).NewClient(); var issueTypes = await client.GetIssueTypesAsync(projectId); var issue = await client2.CreateIssueAsync(new CreateIssueParams(projectId, "NotificationTestIssue", issueTypes.First().Id, IssuePriorityType.High) { NotifiedUserIds = new[] { ownUser.Id } }); var count = await client.GetNotificationCountAsync(new GetNotificationCountParams()); Assert.IsTrue(count > 0); await client.GetNotificationCountAsync(new GetNotificationCountParams() { AlreadyRead = true }); await client.GetNotificationCountAsync(new GetNotificationCountParams() { ResourceAlreadyRead = true }); await client.GetNotificationsAsync(new QueryParams() { Count = 100, MinId = 1, MaxId = int.MaxValue, Order = Order.Desc }); var notifications = await client.GetNotificationsAsync(); Assert.IsTrue(notifications.Any(x => x?.Issue.Id == issue.Id)); var notification = notifications.First(x => x?.Issue.Id == issue.Id); await client.MarkAsReadNotificationAsync(notification.Id); await client.ResetNotificationCountAsync(); await client.DeleteIssueAsync(issue.Id); }
public static async Task SetupClient(TestContext context) { generalConfig = GeneralConfig.Instance.Value; var conf = new BacklogJpConfigure(generalConfig.SpaceKey); conf.ApiKey = generalConfig.ApiKey; client = new BacklogClientFactory(conf).NewClient(); var users = await client.GetUsersAsync(); projectKey = generalConfig.ProjectKey; var project = await client.GetProjectAsync(projectKey); projectId = project.Id; issueTypes = await client.GetIssueTypesAsync(projectId); var conf2 = new BacklogJpConfigure(generalConfig.SpaceKey); conf2.ApiKey = generalConfig.ApiKey2; var client2 = new BacklogClientFactory(conf).NewClient(); anotherUser = await client2.GetMyselfAsync(); }