Sonarr/NzbDrone.Core.Test/Framework/CoreTest.cs

56 lines
1.2 KiB
C#
Raw Normal View History

2013-02-05 04:07:07 +00:00
using System;
using System.IO;
2013-02-05 04:07:07 +00:00
using NUnit.Framework;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.Framework
{
public abstract class CoreTest : TestBase
{
protected static ProgressNotification MockNotification
{
get
{
return new ProgressNotification("Mock notification");
}
}
protected static void ThrowException()
{
throw new ApplicationException("This is a message for test exception");
}
protected FileStream OpenRead(params string[] path)
{
return File.OpenRead(Path.Combine(path));
}
2013-02-05 04:07:07 +00:00
}
public abstract class CoreTest<TSubject> : CoreTest where TSubject: class
2013-02-05 04:07:07 +00:00
{
private TSubject _subject;
2013-02-05 04:07:07 +00:00
[SetUp]
public void CoreTestSetup()
{
_subject = null;
2013-02-05 04:07:07 +00:00
}
protected TSubject Subject
{
get
{
if (_subject == null)
{
_subject = Mocker.Resolve<TSubject>();
}
return _subject;
}
}
2013-02-05 04:07:07 +00:00
}
}