mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Moved source code under src folder - massive change
This commit is contained in:
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user