removed strict mock from test base.

pull/3113/head
kay.one 12 years ago
parent d2104e189f
commit 652a9d4a8a

@ -96,8 +96,6 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void IsAcceptableSize_false_single_episode_not_first_or_last_30_minute()
{
WithStrictMocker();
parseResultSingle.Series = series30minutes;
parseResultSingle.Report.Size = 1.Gigabytes();
@ -117,7 +115,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void IsAcceptableSize_false_single_episode_not_first_or_last_60_minute()
{
WithStrictMocker();
parseResultSingle.Series = series60minutes;
parseResultSingle.Report.Size = 1.Gigabytes();
@ -138,7 +136,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void IsAcceptableSize_true_multi_episode_not_first_or_last_30_minute()
{
WithStrictMocker();
parseResultMulti.Series = series30minutes;
parseResultMulti.Report.Size = 184572800;
@ -159,7 +157,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void IsAcceptableSize_true_multi_episode_not_first_or_last_60_minute()
{
WithStrictMocker();
parseResultMulti.Series = series60minutes;
parseResultMulti.Report.Size = 368572800;
@ -180,7 +178,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void IsAcceptableSize_false_multi_episode_not_first_or_last_30_minute()
{
WithStrictMocker();
parseResultMulti.Series = series30minutes;
parseResultMulti.Report.Size = 1.Gigabytes();
@ -201,7 +199,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void IsAcceptableSize_false_multi_episode_not_first_or_last_60_minute()
{
WithStrictMocker();
parseResultMulti.Series = series60minutes;
parseResultMulti.Report.Size = 10.Gigabytes();
@ -222,7 +220,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void IsAcceptableSize_true_single_episode_first_30_minute()
{
WithStrictMocker();
parseResultSingle.Series = series30minutes;
parseResultSingle.Report.Size = 184572800;
@ -243,7 +241,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void IsAcceptableSize_true_single_episode_first_60_minute()
{
WithStrictMocker();
parseResultSingle.Series = series60minutes;
parseResultSingle.Report.Size = 368572800;
@ -264,7 +262,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void IsAcceptableSize_false_single_episode_first_30_minute()
{
WithStrictMocker();
parseResultSingle.Series = series30minutes;
parseResultSingle.Report.Size = 1.Gigabytes();
@ -285,7 +283,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void IsAcceptableSize_false_single_episode_first_60_minute()
{
WithStrictMocker();
parseResultSingle.Series = series60minutes;
parseResultSingle.Report.Size = 10.Gigabytes();
@ -306,7 +304,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void IsAcceptableSize_true_unlimited_30_minute()
{
WithStrictMocker();
parseResultSingle.Series = series30minutes;
parseResultSingle.Report.Size = 18457280000;
@ -328,7 +326,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void IsAcceptableSize_true_unlimited_60_minute()
{
WithStrictMocker();
parseResultSingle.Series = series60minutes;
parseResultSingle.Report.Size = 36857280000;

@ -23,7 +23,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void Register_should_add_new_application_to_local_growl_instance()
{
WithStrictMocker();
Mocker.Resolve<GrowlProvider>().Register("localhost", 23053, "");
@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void TestNotification_should_send_a_message_to_local_growl_instance()
{
WithStrictMocker();
Mocker.Resolve<GrowlProvider>().TestNotification("localhost", 23053, "");
@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void OnGrab_should_send_a_message_to_local_growl_instance()
{
WithStrictMocker();
Mocker.Resolve<GrowlProvider>().SendNotification("Episode Grabbed", "Series Title - 1x05 - Episode Title", "GRAB", "localhost", 23053, "");
@ -62,7 +62,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void OnDownload_should_send_a_message_to_local_growl_instance()
{
WithStrictMocker();
Mocker.Resolve<GrowlProvider>().SendNotification("Episode Downloaded", "Series Title - 1x05 - Episode Title", "DOWNLOAD", "localhost", 23053, "");

@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.With(e => e.EpisodeFile = episodeFiles[1])
.Build().ToList();
WithStrictMocker();
Mocker.GetMock<IEpisodeService>()
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.With(e => e.EpisodeFile = episodeFiles[1])
.Build().ToList();
WithStrictMocker();
Mocker.GetMock<IEpisodeService>()
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
@ -138,7 +138,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.With(e => e.EpisodeFile = episodeFiles[1])
.Build().ToList();
WithStrictMocker();
Mocker.GetMock<IEpisodeService>()
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
@ -187,7 +187,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.With(e => e.EpisodeFile = episodeFiles[1])
.Build().ToList();
WithStrictMocker();
Mocker.GetMock<IEpisodeService>()
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
@ -236,7 +236,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.With(e => e.EpisodeFile = episodeFiles[1])
.Build().ToList();
WithStrictMocker();
Mocker.GetMock<IEpisodeService>()
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);

@ -29,7 +29,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void Verify_should_return_true_for_a_valid_apiKey()
{
WithStrictMocker();
var result = Mocker.Resolve<ProwlProvider>().Verify(_apiKey);
@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void Verify_should_return_false_for_an_invalid_apiKey()
{
WithStrictMocker();
var result = Mocker.Resolve<ProwlProvider>().Verify(_badApiKey);
@ -56,7 +56,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void SendNotification_should_return_true_for_a_valid_apiKey()
{
WithStrictMocker();
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey);
@ -69,7 +69,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void SendNotification_should_return_false_for_an_invalid_apiKey()
{
WithStrictMocker();
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _badApiKey);
@ -83,7 +83,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void SendNotification_should_alert_with_high_priority()
{
WithStrictMocker();
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone (High)", _apiKey, NotificationPriority.High);
@ -96,7 +96,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void SendNotification_should_alert_with_VeryLow_priority()
{
WithStrictMocker();
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone (VeryLow)", _apiKey, NotificationPriority.VeryLow);
@ -109,7 +109,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void SendNotification_should_have_a_call_back_url()
{
WithStrictMocker();
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey, NotificationPriority.Normal, "http://www.nzbdrone.com");
@ -122,7 +122,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void SendNotification_should_return_true_for_two_valid_apiKey()
{
WithStrictMocker();
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey + ", " + _apiKey2);
@ -135,7 +135,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void SendNotification_should_return_true_for_valid_apiKey_with_bad_apiKey()
{
WithStrictMocker();
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey + ", " + _badApiKey);

@ -291,7 +291,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void Notify_true()
{
WithStrictMocker();
var header = "NzbDrone Test";
var message = "Test Message!";
@ -314,7 +314,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void SendCommand()
{
WithStrictMocker();
var host = "localhost:8080";
var command = "ExecBuiltIn(CleanLibrary(video))";
@ -339,7 +339,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void GetXbmcSeriesPath_true()
{
WithStrictMocker();
var queryResult = @"<xml><record><field>smb://xbmc:xbmc@HOMESERVER/TV/30 Rock/</field></record></xml>";
@ -372,7 +372,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void GetXbmcSeriesPath_false()
{
WithStrictMocker();
var queryResult = @"<xml></xml>";
@ -405,7 +405,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void GetXbmcSeriesPath_special_characters()
{
WithStrictMocker();
var queryResult = @"<xml><record><field>smb://xbmc:xbmc@HOMESERVER/TV/Law & Order- Special Victims Unit/</field></record></xml>";
@ -438,7 +438,7 @@ namespace NzbDrone.Core.Test.ProviderTests
public void Clean()
{
WithStrictMocker();
var fakeConfig = Mocker.GetMock<IConfigService>();
fakeConfig.SetupGet(s => s.XbmcHosts).Returns("localhost:8080");

@ -99,20 +99,6 @@ namespace NzbDrone.Test.Common
catch (Exception)
{
}
}
[Obsolete("Use Mock.Verify() instead")]
protected void WithStrictMocker()
{
return;
//TODO: Remove dependency on restrict mocks!
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);
}
protected void WithTempAsAppPath()
@ -127,8 +113,6 @@ namespace NzbDrone.Test.Common
return Path.Combine(Directory.GetCurrentDirectory(), "Files", fileName);
}
protected void VerifyEventPublished<TEvent>() where TEvent : IEvent
{
VerifyEventPublished<TEvent>(Times.Once());

Loading…
Cancel
Save