Updated tests to work better with VS2013 Test Adapter.

This commit is contained in:
Taloth Saldono 2014-05-04 16:33:25 +02:00
parent 388943ea1b
commit 79b2b14668
11 changed files with 121 additions and 112 deletions

View file

@ -109,9 +109,15 @@ namespace NzbDrone.Test.Common
try
{
if (Directory.Exists(TempFolder))
var tempFolder = new DirectoryInfo(TempFolder);
if (tempFolder.Exists)
{
Directory.Delete(TempFolder, true);
foreach (var file in tempFolder.GetFiles("*", SearchOption.AllDirectories))
{
file.IsReadOnly = false;
}
tempFolder.Delete(true);
}
}
catch (Exception)
@ -119,7 +125,6 @@ namespace NzbDrone.Test.Common
}
}
protected IAppFolderInfo TestFolderInfo { get; private set; }
protected void WindowsOnly()
@ -148,26 +153,11 @@ namespace NzbDrone.Test.Common
TestFolderInfo = Mocker.GetMock<IAppFolderInfo>().Object;
}
protected string GetTestFilePath(string fileName)
protected string GetTempFilePath()
{
return Path.Combine(SandboxFolder, fileName);
return Path.Combine(TempFolder, Path.GetRandomFileName());
}
protected string GetTestFilePath()
{
return GetTestFilePath(Path.GetRandomFileName());
}
protected string SandboxFolder
{
get
{
var folder = Path.Combine(Directory.GetCurrentDirectory(), "Files");
Directory.CreateDirectory(folder);
return folder;
}
}
protected void VerifyEventPublished<TEvent>() where TEvent : class, IEvent
{
VerifyEventPublished<TEvent>(Times.Once());