Exemple #1
0
        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;

            gitConfig = GitConfig.Instance.Value;

            ownUser = await client.GetMyselfAsync();

            var numericUserIds = (await client.GetUsersAsync()).ToDictionary(x => x.UserId, x => x.Id);

            notifiedNumericUserIds = new[]
            { gitConfig.NotifiedUserId1, gitConfig.NotifiedUserId2, gitConfig.NotifiedUserId3 }
            .Select(x => numericUserIds[x])
            .ToArray();

            assigneeUserIds = new[]
            { gitConfig.AssigneeUserId1, gitConfig.AssigneeUserId2, gitConfig.AssigneeUserId3 }
            .Select(x => numericUserIds[x])
            .ToArray();
        }
Exemple #2
0
        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();
        }
        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;

            ownUser = await client.GetMyselfAsync();
        }
Exemple #4
0
        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);
        }