mirror of https://github.com/abpframework/abp.git
8 changed files with 103 additions and 23 deletions
@ -0,0 +1,17 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace Volo.Abp.Cli.Build |
||||
|
{ |
||||
|
public class DotNetProjectInfoEqualityComparer : EqualityComparer<DotNetProjectInfo> |
||||
|
{ |
||||
|
public override bool Equals(DotNetProjectInfo x, DotNetProjectInfo y) |
||||
|
{ |
||||
|
return (x == null && y == null) || (x != null && y != null && x.CsProjPath == y.CsProjPath); |
||||
|
} |
||||
|
|
||||
|
public override int GetHashCode(DotNetProjectInfo obj) |
||||
|
{ |
||||
|
return obj == null ? 0 : obj.CsProjPath.GetHashCode(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
namespace Volo.Abp.Cli.Build |
||||
|
{ |
||||
|
public interface IGitRepositoryHelper |
||||
|
{ |
||||
|
string GetLastCommitId(GitRepository repository); |
||||
|
|
||||
|
string GetFriendlyName(GitRepository repository); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,52 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using Shouldly; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Abp.Cli.Build |
||||
|
{ |
||||
|
public class GitRepository_Tests : AbpCliTestBase |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void GetUniqueName_Test() |
||||
|
{ |
||||
|
var gitRepository = new GitRepository("repo-1", "dev", "") |
||||
|
{ |
||||
|
DependingRepositories = new List<GitRepository> |
||||
|
{ |
||||
|
new GitRepository("repo-2", "dev", ""), |
||||
|
new GitRepository("repo-3", "dev", "") |
||||
|
{ |
||||
|
DependingRepositories = new List<GitRepository>() |
||||
|
{ |
||||
|
new GitRepository("repo-4", "dev", "") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
gitRepository.GetUniqueName("").ShouldBe("B25C935F97D7B3375530A96B392B7644"); |
||||
|
gitRepository.GetUniqueName("production").ShouldBe("production_B25C935F97D7B3375530A96B392B7644"); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public void FindRepositoryOf_Test() |
||||
|
{ |
||||
|
var gitRepository = new GitRepository("repo-1", "dev", "/repo-1/dev/") |
||||
|
{ |
||||
|
DependingRepositories = new List<GitRepository> |
||||
|
{ |
||||
|
new GitRepository("repo-2", "dev", "/repo-2/dev/"), |
||||
|
new GitRepository("repo-3", "dev", "/repo-3/dev/") |
||||
|
{ |
||||
|
DependingRepositories = new List<GitRepository>() |
||||
|
{ |
||||
|
new GitRepository("repo-4", "dev", "/repo-4/dev/") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
gitRepository.FindRepositoryOf("/repo-4/dev/A.csproj").ShouldBe("repo-4"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue