net451 build issue

This commit is contained in:
PiotrP 2016-04-25 19:24:06 -07:00
parent 84f10f58e9
commit 3c2459afa2

View file

@ -93,21 +93,26 @@ namespace Microsoft.DotNet.TestFramework
throw new Exception($"Cannot find '{testProjectName}' at '{AssetsRoot}'");
}
#if NET451
string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
#else
string baseDirectory = AppContext.BaseDirectory;
#endif
string testDestination = Path.Combine(baseDirectory, callingMethod + identifier, testProjectName);
var testDestination = GetTestDestinationDirectoryPath(testProjectName, callingMethod, identifier);
var testInstance = new TestInstance(testProjectDir, testDestination);
return testInstance;
}
public TestDirectory CreateTestDirectory([CallerMemberName] string callingMethod = "", string identifier = "")
{
string testDestination = Path.Combine(AppContext.BaseDirectory, callingMethod + identifier);
var testDestination = GetTestDestinationDirectoryPath(string.Empty, callingMethod, identifier);
return new TestDirectory(testDestination);
}
private string GetTestDestinationDirectoryPath(string testProjectName, string callingMethod, string identifier)
{
#if NET451
string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
#else
string baseDirectory = AppContext.BaseDirectory;
#endif
return Path.Combine(baseDirectory, callingMethod + identifier, testProjectName);
}
}
}