1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-25 17:17:02 +00:00

Merge branch 'kay.one' of github.com:NzbDrone/NzbDrone into markus

This commit is contained in:
Mark McDowall 2011-11-02 19:44:51 -07:00
commit eb6b5a6b0e
2 changed files with 12 additions and 4 deletions

View file

@ -12,7 +12,6 @@ public class EnviromentProviderTest
readonly EnviromentProvider enviromentController = new EnviromentProvider(); readonly EnviromentProvider enviromentController = new EnviromentProvider();
[Test] [Test]
public void Is_user_interactive_should_be_false() public void Is_user_interactive_should_be_false()
{ {
enviromentController.IsUserInteractive.Should().BeTrue(); enviromentController.IsUserInteractive.Should().BeTrue();
@ -41,6 +40,14 @@ public void ApplicationPath_should_not_be_empty()
Path.IsPathRooted(enviromentController.ApplicationPath).Should().BeTrue("Path is not rooted"); Path.IsPathRooted(enviromentController.ApplicationPath).Should().BeTrue("Path is not rooted");
} }
[Test]
public void ApplicationPath_should_find_iis_in_current_folder()
{
Directory.CreateDirectory(EnviromentProvider.IIS_FOLDER_NAME);
enviromentController.ApplicationPath.Should().BeEquivalentTo(Directory.GetCurrentDirectory());
}
[Test] [Test]
public void IsProduction_should_return_false_when_run_within_nunit() public void IsProduction_should_return_false_when_run_within_nunit()
{ {

View file

@ -7,6 +7,7 @@ namespace NzbDrone.Common
{ {
public class EnviromentProvider public class EnviromentProvider
{ {
public const string IIS_FOLDER_NAME = "iisexpress";
#if DEBUG #if DEBUG
private static readonly bool isInDebug = true; private static readonly bool isInDebug = true;
@ -45,7 +46,7 @@ public virtual string ApplicationPath
{ {
get get
{ {
var dir = new FileInfo(Environment.CurrentDirectory).Directory; var dir = new DirectoryInfo(Environment.CurrentDirectory);
while (!ContainsIIS(dir)) while (!ContainsIIS(dir))
{ {
@ -79,7 +80,7 @@ public virtual string AppDataPath
{ {
get get
{ {
var path = Path.Combine(WebRoot, "App_data"); var path = Path.Combine(WebRoot, "App_Data");
if (!Directory.Exists(path)) if (!Directory.Exists(path))
Directory.CreateDirectory(path); Directory.CreateDirectory(path);
@ -121,7 +122,7 @@ public virtual String TempPath
private static bool ContainsIIS(DirectoryInfo dir) private static bool ContainsIIS(DirectoryInfo dir)
{ {
return dir.GetDirectories("iisexpress").Length != 0; return dir.GetDirectories(IIS_FOLDER_NAME).Length != 0;
} }
} }
} }