mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-22 19:04:59 +00:00
1
This commit is contained in:
parent
4f79ad0ee0
commit
46ae4064f9
1 changed files with 11 additions and 13 deletions
|
@ -104,21 +104,19 @@ namespace SourceGit.Models
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
/// Inplace Test
|
/// Inplace Test
|
||||||
|
|
||||||
if (!remote.TryGetVisitURL(out var url))
|
if (remote.TryGetVisitURL(out var url))
|
||||||
Debug.Assert(GetCommitLinkOriginalImplementionForTestPurposes(url) == rr, " checking comparing with initial implementation failed, TODO: delete in future");
|
{
|
||||||
|
var commitLink = GetCommitLinkOriginalImplementionForTestPurposes(url);
|
||||||
|
Debug.Assert(commitLink == rr, " checking comparing with initial implementation failed, TODO: delete in future");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return rr;
|
return rr;
|
||||||
}).Where(cl => cl != null ).ToList();
|
}).Where(cl => cl != null).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// Minimal stub for Remote for testing
|
// Minimal stub for Remote for testing
|
||||||
public class DebugRemote : Remote
|
|
||||||
{
|
|
||||||
private readonly string _url;
|
|
||||||
public DebugRemote(string url) { _url = url; }
|
|
||||||
public new bool TryGetVisitURL(out string url) { url = _url; return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO : delete this after checking the implementation
|
// TODO : delete this after checking the implementation
|
||||||
private static CommitLink? GetCommitLinkOriginalImplementionForTestPurposes(string url)
|
private static CommitLink? GetCommitLinkOriginalImplementionForTestPurposes(string url)
|
||||||
|
@ -149,16 +147,16 @@ namespace SourceGit.Models
|
||||||
static CommitLink()
|
static CommitLink()
|
||||||
{
|
{
|
||||||
|
|
||||||
//Unit tests , TODO: make normal UnitTests.
|
//Unit tests , TODO: make normal UnitTests, delete this code.
|
||||||
// Test Github
|
// Test Github
|
||||||
var githubRemote = new DebugRemote("https://github.com/user/repo.git");
|
var githubRemote = new Remote() { URL = "https://github.com/user/repo.git" };
|
||||||
var links = Get(new List<Remote> { githubRemote });
|
var links = Get(new List<Remote> { githubRemote });
|
||||||
Debug.Assert(links.Count == 1, "Should find one CommitLink for Github");
|
Debug.Assert(links.Count == 1, "Should find one CommitLink for Github");
|
||||||
Debug.Assert(links[0].Name.StartsWith("Github"), "Provider should be Github");
|
Debug.Assert(links[0].Name.StartsWith("Github"), "Provider should be Github");
|
||||||
Debug.Assert(links[0].URLPrefix == "https://github.com/user/repo/commit/", "URLPrefix should be correct for Github");
|
Debug.Assert(links[0].URLPrefix == "https://github.com/user/repo/commit/", "URLPrefix should be correct for Github");
|
||||||
|
|
||||||
// Test BitBucket
|
// Test BitBucket
|
||||||
var bitbucketRemote = new DebugRemote("https://bitbucket.org/team/project");
|
var bitbucketRemote = new Remote() { URL = "https://bitbucket.org/team/project" };
|
||||||
links = Get(new List<Remote> { bitbucketRemote });
|
links = Get(new List<Remote> { bitbucketRemote });
|
||||||
Debug.Assert(links.Count == 1, "Should find one CommitLink for BitBucket");
|
Debug.Assert(links.Count == 1, "Should find one CommitLink for BitBucket");
|
||||||
Debug.Assert(links[0].Name.StartsWith("BitBucket"), "Provider should be BitBucket");
|
Debug.Assert(links[0].Name.StartsWith("BitBucket"), "Provider should be BitBucket");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue