Beispiel #1
0
        public void Update_Existing_Build_Status_Test()
        {
            var existingBuildStatus = new GitRepositoryBuildStatus("volo", "dev")
            {
                SucceedProjects = new List <DotNetProjectBuildStatus>
                {
                    new DotNetProjectBuildStatus
                    {
                        CsProjPath = "project1.csproj",
                        CommitId   = "1"
                    }
                }
            };

            var newBuildStatus = new GitRepositoryBuildStatus(
                existingBuildStatus.RepositoryName,
                existingBuildStatus.BranchName
                )
            {
                SucceedProjects = new List <DotNetProjectBuildStatus>
                {
                    new DotNetProjectBuildStatus
                    {
                        CsProjPath = "project1.csproj",
                        CommitId   = "2"
                    },
                    new DotNetProjectBuildStatus
                    {
                        CsProjPath = "project2.csproj",
                        CommitId   = "2"
                    }
                }
            };

            existingBuildStatus.MergeWith(newBuildStatus);
            existingBuildStatus.SucceedProjects.Count.ShouldBe(2);
            existingBuildStatus.GetSelfOrChild("volo").SucceedProjects.First(p => p.CsProjPath == "project1.csproj")
            .CommitId.ShouldBe("2");
            existingBuildStatus.GetSelfOrChild("volo").SucceedProjects.First(p => p.CsProjPath == "project2.csproj")
            .CommitId.ShouldBe("2");
        }
Beispiel #2
0
        public void GetSelfOrChild_Test()
        {
            var existingBuildStatus = new GitRepositoryBuildStatus("repo-1", "dev")
            {
                DependingRepositories = new List <GitRepositoryBuildStatus>()
                {
                    new GitRepositoryBuildStatus("repo-2", "dev")
                    {
                        DependingRepositories = new List <GitRepositoryBuildStatus>()
                        {
                            new GitRepositoryBuildStatus("repo-3", "dev")
                        }
                    },
                    new GitRepositoryBuildStatus("repo-4", "dev")
                }
            };

            existingBuildStatus.GetSelfOrChild("repo-1").RepositoryName.ShouldBe("repo-1");
            existingBuildStatus.GetSelfOrChild("repo-2").RepositoryName.ShouldBe("repo-2");
            existingBuildStatus.GetSelfOrChild("repo-3").RepositoryName.ShouldBe("repo-3");
            existingBuildStatus.GetSelfOrChild("repo-4").RepositoryName.ShouldBe("repo-4");
        }