Skip to content
This repository was archived by the owner on Feb 12, 2023. It is now read-only.

Adding support for TFS collections on Visual Studio. #174

Merged
merged 2 commits into from
Sep 5, 2017

Conversation

ShaiNahum
Copy link
Contributor

@ShaiNahum ShaiNahum commented Aug 23, 2017

Fixes #173 .

Checklist

  • I have included examples or tests
  • I have updated the change log
  • I am listed in the CONTRIBUTORS file
  • I have cleaned up the commit history (use rebase and squash)

Changes proposed in this pull request:

@GeertvanHorrik GeertvanHorrik added this to the 3.1.0 milestone Aug 23, 2017
@GeertvanHorrik GeertvanHorrik self-assigned this Aug 23, 2017
@GeertvanHorrik GeertvanHorrik self-requested a review August 23, 2017 17:54
@GeertvanHorrik
Copy link
Contributor

Thanks a lot for your efforts! There is just 1 thing I'd like to see different, care for changing that?

@@ -72,6 +72,15 @@ public void ReturnsValidProject2()
}

[TestCase]
public void ReturnsValidProject3()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to just refactor ReturnsValidProject into this:

[TestCase("https://CatenaLogic.visualstudio.com/_git/main-repo", "main-repo")]
[TestCase("https://CatenaLogic.visualstudio.com/BigProject/_git/main-repo", "BigProject")]
[TestCase("https://CatenaLogic.visualstudio.com/DefaultCollection/BigProject/_git/main-repo", "BigProject")]
public void ReturnsValidProject(string url, string expectedProjectName)
{
	var provider = new VisualStudioTeamServicesProvider();
	provider.Initialize(url);

	Assert.AreEqual(expectedProjectName, provider.ProjectName);
}

private static readonly Regex HostingUrlPattern = new Regex(@"(?<url>(?<companyurl>(?:https://)?(?<accountname>([a-zA-Z0-9\-\.]*)?)\.visualstudio\.com/)(?<project>[a-zA-Z0-9\-\.]*)/?_git//?(?<repo>[^/]+))");
// Matches the git origin URL, providing named capture groups
// Example match: https://user.visualstudio.com/DefaultCollection/MyFirstProject/_git/MyFirstRepo
private static readonly Regex HostingUrlPattern =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, never saw regular expressions split up so nicely, well done.

@ShaiNahum
Copy link
Contributor Author

Good call on the requested changes. I'm still not used to NUnit.
I've modified the tests according to your example

@GeertvanHorrik
Copy link
Contributor

Sorry for the late review, missed notifications. All looks good now, thanks!

@GeertvanHorrik GeertvanHorrik merged commit 75f9935 into GitTools:develop Sep 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants