mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
All tests now use base class Mocker
This commit is contained in:
parent
ab29a114d1
commit
1b45a85f3f
39 changed files with 1002 additions and 1010 deletions
|
@ -1,4 +1,5 @@
|
|||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
@ -12,7 +13,19 @@ namespace NzbDrone.Test.Common
|
|||
|
||||
protected const string INTEGRATION_TEST = "Integration Test";
|
||||
|
||||
protected AutoMoqer Mocker { get; private set; }
|
||||
private AutoMoqer _mocker;
|
||||
protected AutoMoqer Mocker
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_mocker == null)
|
||||
{
|
||||
_mocker = new AutoMoqer();
|
||||
}
|
||||
|
||||
return _mocker;
|
||||
}
|
||||
}
|
||||
|
||||
protected string VirtualPath
|
||||
{
|
||||
|
@ -34,19 +47,20 @@ namespace NzbDrone.Test.Common
|
|||
}
|
||||
|
||||
Directory.CreateDirectory(TempFolder);
|
||||
|
||||
Mocker = new AutoMoqer();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TestBaseTearDown()
|
||||
{
|
||||
|
||||
_mocker = null;
|
||||
}
|
||||
|
||||
protected void WithStrictMocker()
|
||||
{
|
||||
Mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
if (_mocker != null)
|
||||
throw new InvalidOperationException("Can not switch to a strict container after container has been used. make sure this is the first call in your test.");
|
||||
|
||||
_mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue