-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: repository path not being inferred
- Loading branch information
1 parent
3e1a0fb
commit 664ab50
Showing
4 changed files
with
100 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using Affected.Cli.Commands; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Xunit; | ||
|
||
namespace Affected.Cli.Tests | ||
{ | ||
public class RepositoryPathTests | ||
{ | ||
private class TestPathsClassData : IEnumerable<object[]> | ||
{ | ||
public IEnumerator<object[]> GetEnumerator() | ||
{ | ||
yield return new object[] | ||
{ | ||
"/home/lchaia/dotnet-affected", "", "/home/lchaia/dotnet-affected" | ||
}; | ||
yield return new object[] | ||
{ | ||
"", "/home/lchaia/dotnet-affected/Affected.sln", "/home/lchaia/dotnet-affected" | ||
}; | ||
yield return new object[] | ||
{ | ||
"/home/lchaia/dotnet-affected", "/home/lchaia/dotnet-affected/subdirectory/other/Affected.sln", | ||
"/home/lchaia/dotnet-affected" | ||
}; | ||
yield return new object[] | ||
{ | ||
"", "", Environment.CurrentDirectory | ||
}; | ||
} | ||
|
||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | ||
} | ||
|
||
[Theory] | ||
[ClassData(typeof(TestPathsClassData))] | ||
public void Should_determine_repository_path_correctly( | ||
string repositoryPath, | ||
string solutionPath, | ||
string expected) | ||
{ | ||
var data = new CommandExecutionData( | ||
repositoryPath, | ||
solutionPath, | ||
string.Empty, | ||
string.Empty, | ||
false, | ||
Enumerable.Empty<string>()); | ||
|
||
Assert.Equal(expected, data.RepositoryPath); | ||
} | ||
} | ||
} |
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