Skip to content

Commit

Permalink
Add test for BuildOwnerAndRepositoryFromUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchxu committed Apr 2, 2021
1 parent fae7578 commit 9345690
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/GprTool.Tests/NuGetUtilitiesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,27 @@ public void BuildOwnerAndRepositoryFromUrlFromNupkg(string repositoryUrl, string
Assert.That(packageFile.RepositoryUrl, Is.EqualTo(expectedGithubRepositoryUrl));
}

[TestCase("ritchxu/gpr", true, "ritchxu", "gpr", "https://github.com/ritchxu/gpr", "nuget.pkg.github.com")]
[TestCase("https://foo.githubenterprise.com/ritchxu/gpr", true, "ritchxu", "gpr", "https://foo.githubenterprise.com/ritchxu/gpr", "nuget.foo.githubenterprise.com")]
[TestCase("https://foo.bar.com/ritchxu/gpr", false, null, null, null, null)]
public void BuildOwnerAndRepositoryFromUrl(
string repositoryUrl,
bool expectedResult,
string expectedOwner,
string expectedRepositoryName,
string expectedGithubRepositoryUrl,
string expectedNugetPackageEndpoint)
{
var packageFile = new PackageFile();

Assert.That(NuGetUtilities.BuildOwnerAndRepositoryFromUrl(packageFile, repositoryUrl), Is.EqualTo(expectedResult));

Assert.That(packageFile.Owner, Is.EqualTo(expectedOwner));
Assert.That(packageFile.RepositoryName, Is.EqualTo(expectedRepositoryName));
Assert.That(packageFile.RepositoryUrl, Is.EqualTo(expectedGithubRepositoryUrl));
Assert.That(packageFile.NugetPackageEndpoint, Is.EqualTo(expectedNugetPackageEndpoint));
}

[Test]
public void ReadNupkgManifest()
{
Expand Down

0 comments on commit 9345690

Please sign in to comment.