public void Should_Set_Repository_CommitId_When_All_Projects_Built() { var buildConfig = new DotNetProjectBuildConfig { GitRepository = new GitRepository("volo", "dev", "") { DependingRepositories = new List <GitRepository>() { new GitRepository("abp", "dev", "") } } }; var changedProjects = new List <DotNetProjectInfo>() { new DotNetProjectInfo("volo", "project1.csproj", true) }; var builtProjects = new List <string>() { "project1.csproj" }; var lastCommitId = "1"; _gitRepositoryHelper.GetLastCommitId(buildConfig.GitRepository).Returns(lastCommitId); _gitRepositoryHelper.GetFriendlyName(buildConfig.GitRepository).Returns("volo"); var status = _buildStatusGenerator.Generate(buildConfig, changedProjects, builtProjects); status.CommitId.ShouldBe(lastCommitId); }
public GitRepositoryBuildStatus Generate( DotNetProjectBuildConfig buildConfig, List <DotNetProjectInfo> changedProjects, List <string> buildSucceededProjects) { var lastCommitId = _gitRepositoryHelper.GetLastCommitId(buildConfig.GitRepository); var repoFriendlyName = _gitRepositoryHelper.GetFriendlyName(buildConfig.GitRepository); var status = new GitRepositoryBuildStatus( buildConfig.GitRepository.Name, repoFriendlyName ); if (ShouldUpdateRepositoryCommitId(buildConfig, changedProjects, buildSucceededProjects)) { status.CommitId = lastCommitId; } status.SucceedProjects = changedProjects.Where(p => p.RepositoryName == buildConfig.GitRepository.Name && buildSucceededProjects.Contains(p.CsProjPath) ) .Select(e => new DotNetProjectBuildStatus { CsProjPath = e.CsProjPath, CommitId = lastCommitId }).ToList(); foreach (var dependingRepository in buildConfig.GitRepository.DependingRepositories) { GenerateBuildStatusInternal( buildConfig, dependingRepository, changedProjects, buildSucceededProjects, status ); } return(status); }