1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-28 10:48:46 +00:00
Sonarr/NzbDrone.Core.Test/Framework/CoreTest.cs
2013-06-09 13:50:57 -07:00

52 lines
1.1 KiB
C#

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(new EnvironmentProvider()));
}
}
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;
}
}
}
}