Skip to content

Commit

Permalink
Fix Path operations on non-Windows platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
hazzik committed Oct 23, 2017
1 parent 6709b07 commit 5d34e75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
14 changes: 4 additions & 10 deletions Source/AsyncGenerator.Tests/BaseFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,13 @@ protected BaseFixture(string folderPath = null)

public string GetBaseDirectory()
{
// BaseDirectory ends with a backslash when running with Visual Studio (Test Explorer), but when running with
// Reshaper (Unit Test Session) there is no backslash at the end
var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
if (!baseDirectory.EndsWith(@"\"))
{
baseDirectory += @"\";
}
return baseDirectory;
return AppDomain.CurrentDomain.BaseDirectory;
}

public AsyncCodeConfiguration Configure(Action<IFluentProjectConfiguration> action = null)
{
var filePath = Path.GetFullPath(GetBaseDirectory() + @"..\..\AsyncGenerator.Tests.csproj");
var filePath = Path.GetFullPath(Path.Combine(GetBaseDirectory(), "..", "..", "AsyncGenerator.Tests.csproj"));

return AsyncCodeConfiguration.Create()
.ConfigureProject(filePath, p =>
{
Expand All @@ -71,7 +65,7 @@ public AsyncCodeConfiguration Configure(Action<IFluentProjectConfiguration> acti

public AsyncCodeConfiguration Configure(string fileName, Action<IFluentProjectConfiguration> action = null)
{
var slnFilePath = Path.GetFullPath(GetBaseDirectory() + @"..\..\..\AsyncGenerator.sln");
var slnFilePath = Path.GetFullPath(Path.Combine(GetBaseDirectory(), "..", "..", "..", "AsyncGenerator.sln"));
return AsyncCodeConfiguration.Create()
.ConfigureSolution(slnFilePath, c => c
.ConfigureProject("AsyncGenerator.Tests", p =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public void TestYamlProjectConfigurationAfterTransformation()
[Test]
public void TestYamlAfterTransformation()
{
var configPath = Path.GetFullPath(GetBaseDirectory() + @"..\..\ExternalProjects\NHibernate\Source\src\AsyncGenerator.yml");
var configPath = Path.GetFullPath(Path.Combine(GetBaseDirectory(), "..", "..", "ExternalProjects", "NHibernate","Source","src","AsyncGenerator.yml"));

var config = AsyncCodeConfiguration.Create()
.ConfigureFromFile<YamlFileConfigurator>(configPath);
var generator = new AsyncCodeGenerator();
Expand All @@ -76,7 +77,8 @@ public void TestYamlAfterTransformation()
[Test]
public void TestAfterTransformation()
{
var slnFilePath = Path.GetFullPath(GetBaseDirectory() + @"..\..\ExternalProjects\NHibernate\Source\src\NHibernate.sln");
var slnFilePath = Path.GetFullPath(Path.Combine(GetBaseDirectory(), "..", "..", "ExternalProjects", "NHibernate", "Source", "src", "NHibernate.sln"));

var config = AsyncCodeConfiguration.Create()
.ConfigureSolution(slnFilePath, s => s
.ConcurrentRun()
Expand Down

0 comments on commit 5d34e75

Please sign in to comment.