You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/NzbDrone.Core.Test/Framework/CoreTest.cs

58 lines
1.2 KiB

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;
}
}
}
}