public void Add_New_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 = "project2.csproj",
                    CommitId   = "2"
                }
            }
        };

        existingBuildStatus.MergeWith(newBuildStatus);

        existingBuildStatus.SucceedProjects.Count.ShouldBe(2);
    }
    public void Should_Update_Repository_CommitId_When_New_CommitId_Is_Not_Empty()
    {
        var existingBuildStatus = new GitRepositoryBuildStatus("volo", "dev");

        var newBuildStatus = new GitRepositoryBuildStatus(
            existingBuildStatus.RepositoryName,
            existingBuildStatus.BranchName
            )
        {
            CommitId = "42"
        };

        existingBuildStatus.MergeWith(newBuildStatus);

        existingBuildStatus.CommitId.ShouldBe("42");
    }
    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");
    }