Ejemplo n.º 1
0
            public void Should_Set_Comments()
            {
                // Given
                var comments =
                    new List <IPrcaDiscussionComment>
                {
                    new PrcaDiscussionComment
                    {
                        Content   = "Foo",
                        IsDeleted = false
                    },
                    new PrcaDiscussionComment
                    {
                        Content   = "Bar",
                        IsDeleted = true
                    }
                };

                // When
                var thread =
                    new PrcaDiscussionThread(
                        1,
                        PrcaDiscussionStatus.Active,
                        "foo.cs",
                        comments);

                // Then
                thread.Comments.ShouldContain(comment => comments.Contains(comment), comments.Count);
            }
Ejemplo n.º 2
0
            public void Should_Resolve_Closed_Issues()
            {
                // Given
                var threadToResolve =
                    new PrcaDiscussionThread(
                        1,
                        PrcaDiscussionStatus.Active,
                        new FilePath(@"src\Cake.Prca.Tests\FakeCodeAnalysisProvider.cs"),
                        new List <IPrcaDiscussionComment>
                {
                    new PrcaDiscussionComment()
                    {
                        Content   = "Bar",
                        IsDeleted = false
                    }
                })
                {
                    CommentSource = null
                };

                var fixture = new PrcaFixture();

                fixture.CodeAnalysisProviders.Clear();
                fixture.CodeAnalysisProviders.Add(
                    new FakeCodeAnalysisProvider(
                        fixture.Log,
                        new List <ICodeAnalysisIssue>
                {
                    new CodeAnalysisIssue(
                        @"src\Cake.Prca.Tests\FakeCodeAnalysisProvider.cs",
                        10,
                        "Foo",
                        0,
                        "Foo",
                        "Foo")
                }));

                fixture.PullRequestSystem =
                    new FakePullRequestSystem(
                        fixture.Log,
                        new List <IPrcaDiscussionThread>
                {
                    threadToResolve
                },
                        new List <FilePath>
                {
                    new FilePath(@"src\Cake.Prca.Tests\FakeCodeAnalysisProvider.cs")
                });

                // When
                fixture.RunOrchestrator();

                // Then
                fixture.PullRequestSystem.ThreadsMarkedAsFixed.ShouldContain(threadToResolve);
                fixture.Log.Entries.ShouldContain(x => x.Message == "Found 1 existing thread(s) that do not match any new issue and can be resolved.");
            }
Ejemplo n.º 3
0
            public void Should_Set_Status(PrcaDiscussionStatus status)
            {
                // Given / When
                var thread =
                    new PrcaDiscussionThread(
                        1,
                        status,
                        "foo.cs",
                        new List <IPrcaDiscussionComment>());

                // Then
                thread.Status.ShouldBe(status);
            }
Ejemplo n.º 4
0
            public void Should_Set_Id(int id)
            {
                // Given / When
                var thread =
                    new PrcaDiscussionThread(
                        id,
                        PrcaDiscussionStatus.Active,
                        "foo.cs",
                        new List <IPrcaDiscussionComment>());

                // Then
                thread.Id.ShouldBe(id);
            }
Ejemplo n.º 5
0
            public void Should_Handle_File_Paths_Which_Are_Null()
            {
                // Given / When
                var thread =
                    new PrcaDiscussionThread(
                        1,
                        PrcaDiscussionStatus.Active,
                        null,
                        new List <IPrcaDiscussionComment>());

                // Then
                thread.AffectedFileRelativePath.ShouldBe(null);
            }
Ejemplo n.º 6
0
            public void Should_Set_File_Path(string filePath, string expectedFilePath)
            {
                // Given / When
                // Given / When
                var thread =
                    new PrcaDiscussionThread(
                        1,
                        PrcaDiscussionStatus.Active,
                        filePath,
                        new List <IPrcaDiscussionComment>());

                // Then
                thread.AffectedFileRelativePath.ToString().ShouldBe(expectedFilePath);
                thread.AffectedFileRelativePath.IsRelative.ShouldBe(true, "File path was not set as relative.");
            }