mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Moved source code under src folder - massive change
This commit is contained in:
parent
2fc8123d6b
commit
5bf0e197ec
1499 changed files with 1054 additions and 1444 deletions
57
src/NzbDrone.Core.Test/Framework/CoreTest.cs
Normal file
57
src/NzbDrone.Core.Test/Framework/CoreTest.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.Framework
|
||||
{
|
||||
public abstract class CoreTest : TestBase
|
||||
{
|
||||
protected FileStream OpenRead(params string[] path)
|
||||
{
|
||||
return File.OpenRead(Path.Combine(path));
|
||||
}
|
||||
|
||||
protected string ReadAllText(params string[] path)
|
||||
{
|
||||
return File.ReadAllText(Path.Combine(path));
|
||||
}
|
||||
|
||||
protected void UseRealHttp()
|
||||
{
|
||||
Mocker.SetConstant<IHttpProvider>(new HttpProvider(TestLogger));
|
||||
}
|
||||
|
||||
protected void UseRealDisk()
|
||||
{
|
||||
Mocker.SetConstant<IDiskProvider>(new DiskProvider());
|
||||
WithTempAsAppPath();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public abstract class CoreTest<TSubject> : CoreTest where TSubject : class
|
||||
{
|
||||
private TSubject _subject;
|
||||
|
||||
[SetUp]
|
||||
public void CoreTestSetup()
|
||||
{
|
||||
_subject = null;
|
||||
}
|
||||
|
||||
protected TSubject Subject
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_subject == null)
|
||||
{
|
||||
_subject = Mocker.Resolve<TSubject>();
|
||||
}
|
||||
|
||||
return _subject;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue