Esempio n. 1
0
        public async Task CreatedIssueCanBeListedFromProject()
        {
            //arrange
            string title = Guid.NewGuid().ToString();
            await _sut.CreateAsync(new CreateIssueRequest(TestProjectTextId, title));

            //act
            var listedIssues = await _sut.GetAsync(TestProjectTextId, o => o.Filter = title);

            //assert
            listedIssues.Single().Title.Should().Be(title);
        }
        public async Task CreatedIssueCanBeListedFromProject()
        {
            //arrange
            string title = Guid.NewGuid().ToString();
            await _sut.CreateAsync(TestProjectTextId, new CreateIssueRequest(title));

            //act
            var listedIssues = await _sut.GetAsync(TestProjectTextId, o => o.Filter = title);

            //assert
            listedIssues.Single().Should().Match <Issue>(i =>
                                                         i.ProjectId == TestProjectTextId &&
                                                         i.Title == title &&
                                                         i.TimeStats != null);
        }
        public async Task CreatedIssueCanBeRetrieved()
        {
            //arrange
            string title = Guid.NewGuid().ToString();

            var issue = await _sut.CreateAsync(TestProjectTextId, new CreateIssueRequest(title)
            {
                Assignees = new List <int> {
                    1
                },
                Confidential = true,
                Description  = "Description",
                Labels       = new List <string> {
                    "Label1"
                }
            });

            //act
            var issueById = await _sut.GetAsync(TestProjectId, issue.Iid);

            var issueByProjectId = (await _sut.GetAllAsync(options: o => o.IssueIds = new[] { issue.Iid })).FirstOrDefault(i => i.Title == title);
            var ownedIssue       = (await _sut.GetAllAsync(options: o => o.Scope = Scope.CreatedByMe)).FirstOrDefault(i => i.Title == title);

            //assert
            issue.Should().Match <Issue>(i =>
                                         i.ProjectId == TestProjectTextId &&
                                         i.Confidential && i.Title == title && i.Description == "Description" &&
                                         i.Labels.SequenceEqual(new[] { "Label1" }));

            issueById.Should().BeEquivalentTo(issue, o => o.Excluding(s => s.UpdatedAt));
            issueByProjectId.Should().BeEquivalentTo(issue, o => o.Excluding(s => s.UpdatedAt));
            ownedIssue.Should().BeEquivalentTo(issue, o => o.Excluding(s => s.UpdatedAt));
        }