mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
parent
a602611a5f
commit
a4b78b44ce
1307 changed files with 8702 additions and 7403 deletions
|
@ -14,16 +14,15 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
|
||||
namespace NzbDrone.Test.Common
|
||||
{
|
||||
public abstract class TestBase<TSubject> : TestBase where TSubject : class
|
||||
public abstract class TestBase<TSubject> : TestBase
|
||||
where TSubject : class
|
||||
{
|
||||
|
||||
private TSubject _subject;
|
||||
|
||||
[SetUp]
|
||||
public virtual void CoreTestSetup()
|
||||
{
|
||||
_subject = null;
|
||||
|
||||
}
|
||||
|
||||
protected TSubject Subject
|
||||
|
@ -37,9 +36,7 @@ namespace NzbDrone.Test.Common
|
|||
|
||||
return _subject;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public abstract class TestBase : LoggingTest
|
||||
|
@ -64,7 +61,6 @@ namespace NzbDrone.Test.Common
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected int RandomNumber
|
||||
{
|
||||
get
|
||||
|
@ -79,7 +75,10 @@ namespace NzbDrone.Test.Common
|
|||
get
|
||||
{
|
||||
var virtualPath = Path.Combine(TempFolder, "VirtualNzbDrone");
|
||||
if (!Directory.Exists(virtualPath)) Directory.CreateDirectory(virtualPath);
|
||||
if (!Directory.Exists(virtualPath))
|
||||
{
|
||||
Directory.CreateDirectory(virtualPath);
|
||||
}
|
||||
|
||||
return virtualPath;
|
||||
}
|
||||
|
@ -119,7 +118,6 @@ namespace NzbDrone.Test.Common
|
|||
DeleteTempFolder(_tempFolder);
|
||||
}
|
||||
|
||||
|
||||
public static string GetUID()
|
||||
{
|
||||
return Process.GetCurrentProcess().Id + "_" + DateTime.Now.Ticks + "_" + Interlocked.Increment(ref _nextUid);
|
||||
|
@ -200,17 +198,20 @@ namespace NzbDrone.Test.Common
|
|||
return Path.Combine(TempFolder, Path.GetRandomFileName());
|
||||
}
|
||||
|
||||
protected void VerifyEventPublished<TEvent>() where TEvent : class, IEvent
|
||||
protected void VerifyEventPublished<TEvent>()
|
||||
where TEvent : class, IEvent
|
||||
{
|
||||
VerifyEventPublished<TEvent>(Times.Once());
|
||||
}
|
||||
|
||||
protected void VerifyEventPublished<TEvent>(Times times) where TEvent : class, IEvent
|
||||
protected void VerifyEventPublished<TEvent>(Times times)
|
||||
where TEvent : class, IEvent
|
||||
{
|
||||
Mocker.GetMock<IEventAggregator>().Verify(c => c.PublishEvent(It.IsAny<TEvent>()), times);
|
||||
}
|
||||
|
||||
protected void VerifyEventNotPublished<TEvent>() where TEvent : class, IEvent
|
||||
protected void VerifyEventNotPublished<TEvent>()
|
||||
where TEvent : class, IEvent
|
||||
{
|
||||
Mocker.GetMock<IEventAggregator>().Verify(c => c.PublishEvent(It.IsAny<TEvent>()), Times.Never());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue