1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-31 11:24:23 +02:00

60 lines
1.2 KiB
C#
Raw Normal View History

using System.IO;
2013-02-04 20:07:07 -08:00
using NUnit.Framework;
2013-04-15 17:08:06 -07:00
using NzbDrone.Common;
2013-02-04 20:07:07 -08:00
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.Framework
{
public abstract class CoreTest : TestBase
{
2013-02-04 20:07:07 -08:00
protected FileStream OpenRead(params string[] path)
{
return File.OpenRead(Path.Combine(path));
}
protected string ReadAllText(params string[] path)
{
2013-03-28 12:18:08 -07:00
return File.ReadAllText(Path.Combine(path));
}
2013-04-15 17:08:06 -07:00
protected void UseRealHttp()
{
Mocker.SetConstant<IHttpProvider>(new HttpProvider());
2013-04-15 17:08:06 -07:00
}
2013-06-27 17:12:50 -07:00
protected void UseRealDisk()
{
Mocker.SetConstant<IDiskProvider>(new DiskProvider());
WithTempAsAppPath();
}
2013-02-04 20:07:07 -08:00
}
2013-02-23 13:29:22 -08:00
public abstract class CoreTest<TSubject> : CoreTest where TSubject : class
2013-02-04 20:07:07 -08:00
{
private TSubject _subject;
2013-02-04 20:07:07 -08:00
[SetUp]
public void CoreTestSetup()
{
_subject = null;
2013-02-04 20:07:07 -08:00
}
protected TSubject Subject
{
get
{
if (_subject == null)
{
_subject = Mocker.Resolve<TSubject>();
}
return _subject;
}
}
2013-02-04 20:07:07 -08:00
}
}