// Translates
        //   ssh://{account}@{domain}:{port}/{repositoryPath}/_ssh/{"_full"|"_optimized"}/{repositoryName}
        // to
        //   https://{domain}/{repositoryPath}/_git/{repositoryName}
        protected override string?TranslateSshUrl(Uri uri)
        {
            if (!AzureDevOpsUrlParser.TryParseOnPremSsh(uri, out var repositoryPath, out var repositoryName))
            {
                return(null);
            }

            return
                (UriUtilities.Combine(
                     UriUtilities.Combine("https://" + uri.Host, repositoryPath), "_git/" + repositoryName));
        }
Пример #2
0
 public void TryParseHostedSsh_Error(string url)
 {
     Assert.False(AzureDevOpsUrlParser.TryParseOnPremSsh(new Uri(url, UriKind.Absolute), out var _, out var _));
 }
Пример #3
0
 public void TryParseOnPremSsh_Success(string url, string repositoryPath, string repositoryName)
 {
     Assert.True(AzureDevOpsUrlParser.TryParseOnPremSsh(new Uri(url, UriKind.Absolute), out var actualRepositoryPath, out var actualRepositoryName));
     Assert.Equal(repositoryPath, actualRepositoryPath);
     Assert.Equal(repositoryName, actualRepositoryName);
 }