This repository has been archived by the owner on Feb 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
555 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="ProjectExtensionsFacts.cs" company="CatenaLogic"> | ||
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved. | ||
// </copyright> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
namespace GitLink.Tests | ||
{ | ||
using NUnit.Framework; | ||
|
||
[TestFixture] | ||
public class ProjectExtensionsFacts | ||
{ | ||
[Test] | ||
public void NoIncludesExcludes_ProjectNotIgnored() | ||
{ | ||
Assert.IsFalse(ProjectHelper.ShouldBeIgnored("project", new string[0], new string[0])); | ||
} | ||
|
||
[TestCase("ignoredProject", "ignoredProject", true)] | ||
[TestCase("ignoredProject", "ignoredproject", true)] | ||
[TestCase("ignoredProject", "/ignoredProject/", true)] | ||
[TestCase("ignoredProject", "/ignoredproject/", true)] | ||
[TestCase("ignoredProject", "/^i\\w+t$/", true)] | ||
[TestCase("nonIgnoredProject", "ignoredProject", false)] | ||
public void ExcludedProject_IgnoredOnlySpecifiedOne(string projectName, string ignorePattern, bool expectedIgnore) | ||
{ | ||
Assert.AreEqual(expectedIgnore, ProjectHelper.ShouldBeIgnored(projectName, new string[0], new[] { ignorePattern })); | ||
} | ||
|
||
[TestCase("anotherProject", "includedProject", true)] | ||
[TestCase("anotherProject", "includedproject", true)] | ||
[TestCase("anotherProject", "/includedProject/", true)] | ||
[TestCase("anotherProject", "/includedproject/", true)] | ||
[TestCase("anotherProject", "/[a-z]+/", false)] | ||
[TestCase("includedProject", "includedProject", false)] | ||
public void ExplicitlyIncludedProject_OthersAreIgnored(string projectName, string includePattern, bool expectedIgnore) | ||
{ | ||
Assert.AreEqual(expectedIgnore, ProjectHelper.ShouldBeIgnored(projectName, new[] { includePattern }, new string[0])); | ||
} | ||
|
||
[TestCase("excludedProject", true)] | ||
[TestCase("includedProject", false)] | ||
[TestCase("includedAndExcludedProject", true)] | ||
[TestCase("notIncludedNorExcludedProject", true)] | ||
public void BothIncludedAndExcludedProjects(string projectName, bool expectedIgnore) | ||
{ | ||
Assert.AreEqual(expectedIgnore, ProjectHelper.ShouldBeIgnored(projectName, | ||
new[] { "includedProject", "includedAndExcludedProject" }, | ||
new[] { "excludedProject", "includedAndExcludedProject" })); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
namespace GitLink.Tests.Providers | ||
{ | ||
using GitLink.Providers; | ||
using NUnit.Framework; | ||
|
||
public class CustomRawUrlProviderFacts | ||
{ | ||
[TestFixture] | ||
public class TheInitialization | ||
{ | ||
[TestCase("http://example.com/repo", true)] | ||
[TestCase("https://example.com/repo", true)] | ||
[TestCase("https://example.com/repo/", true)] | ||
[TestCase("gopher://example.com/repo", false)] | ||
public void CorrectlyValidatesForUrls(string url, bool expectedValue) | ||
{ | ||
var provider = new CustomRawUrlProvider(); | ||
var valid = provider.Initialize(url); | ||
|
||
Assert.AreEqual(expectedValue, valid); | ||
} | ||
} | ||
|
||
[TestFixture] | ||
public class TheGitHubProviderProperties | ||
{ | ||
[TestCase] | ||
public void ReturnsNullCompany() | ||
{ | ||
var provider = new CustomRawUrlProvider(); | ||
provider.Initialize("http://example.com/repo"); | ||
|
||
Assert.IsNull(provider.CompanyName); | ||
} | ||
|
||
[TestCase] | ||
public void ReturnsNullCompanyUrl() | ||
{ | ||
var provider = new CustomRawUrlProvider(); | ||
provider.Initialize("http://example.com/repo"); | ||
|
||
Assert.IsNull(provider.CompanyUrl); | ||
} | ||
|
||
[TestCase] | ||
public void ReturnsNullProject() | ||
{ | ||
var provider = new CustomRawUrlProvider(); | ||
provider.Initialize("http://example.com/repo"); | ||
|
||
Assert.IsNull(provider.ProjectName); | ||
} | ||
|
||
[TestCase] | ||
public void ReturnsNullProjectUrl() | ||
{ | ||
var provider = new CustomRawUrlProvider(); | ||
provider.Initialize("http://example.com/repo"); | ||
|
||
Assert.IsNull(provider.ProjectUrl); | ||
} | ||
|
||
[TestCase] | ||
public void ReturnsValidRawGitUrl() | ||
{ | ||
var provider = new CustomRawUrlProvider(); | ||
provider.Initialize("http://example.com/repo"); | ||
|
||
Assert.AreEqual("http://example.com/repo", provider.RawGitUrl); | ||
} | ||
|
||
[TestCase] | ||
public void ReturnsValidRawGitUrlWithNoTrailingSlash() | ||
{ | ||
var provider = new CustomRawUrlProvider(); | ||
provider.Initialize("http://example.com/repo/"); | ||
|
||
Assert.AreEqual("http://example.com/repo", provider.RawGitUrl); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.