fixed some broken tests.

This commit is contained in:
kay.one 2013-02-24 11:39:31 -08:00
parent 554924a522
commit a98d792c0d
30 changed files with 60 additions and 60 deletions

View File

@ -43,28 +43,28 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_be_true_when_allowedReleaseGroups_is_empty()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns(String.Empty);
Mocker.GetMock<IConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns(String.Empty);
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
}
[Test]
public void should_be_true_when_allowedReleaseGroups_is_nzbs_releaseGroup()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("2HD");
Mocker.GetMock<IConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("2HD");
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
}
[Test]
public void should_be_true_when_allowedReleaseGroups_contains_nzbs_releaseGroup()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("2HD, LOL");
Mocker.GetMock<IConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("2HD, LOL");
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue();
}
[Test]
public void should_be_false_when_allowedReleaseGroups_does_not_contain_nzbs_releaseGroup()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("LOL,DTD");
Mocker.GetMock<IConfigService>().SetupGet(s => s.AllowedReleaseGroups).Returns("LOL,DTD");
Mocker.Resolve<AllowedReleaseGroupSpecification>().IsSatisfiedBy(parseResult).Should().BeFalse();
}
}

View File

@ -38,22 +38,22 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
private void WithUnlimitedRetention()
{
Mocker.GetMock<ConfigService>().SetupGet(c => c.Retention).Returns(0);
Mocker.GetMock<IConfigService>().SetupGet(c => c.Retention).Returns(0);
}
private void WithLongRetention()
{
Mocker.GetMock<ConfigService>().SetupGet(c => c.Retention).Returns(1000);
Mocker.GetMock<IConfigService>().SetupGet(c => c.Retention).Returns(1000);
}
private void WithShortRetention()
{
Mocker.GetMock<ConfigService>().SetupGet(c => c.Retention).Returns(10);
Mocker.GetMock<IConfigService>().SetupGet(c => c.Retention).Returns(10);
}
private void WithEqualRetention()
{
Mocker.GetMock<ConfigService>().SetupGet(c => c.Retention).Returns(100);
Mocker.GetMock<IConfigService>().SetupGet(c => c.Retention).Returns(100);
}
[Test]

View File

@ -30,17 +30,17 @@ namespace NzbDrone.Core.Test.IndexerTests
{
private void WithConfiguredIndexers()
{
Mocker.GetMock<ConfigService>().SetupGet(c => c.NzbsOrgHash).Returns("MockedConfigValue");
Mocker.GetMock<ConfigService>().SetupGet(c => c.NzbsOrgUId).Returns("MockedConfigValue");
Mocker.GetMock<IConfigService>().SetupGet(c => c.NzbsOrgHash).Returns("MockedConfigValue");
Mocker.GetMock<IConfigService>().SetupGet(c => c.NzbsOrgUId).Returns("MockedConfigValue");
Mocker.GetMock<ConfigService>().SetupGet(c => c.NzbsrusHash).Returns("MockedConfigValue");
Mocker.GetMock<ConfigService>().SetupGet(c => c.NzbsrusUId).Returns("MockedConfigValue");
Mocker.GetMock<IConfigService>().SetupGet(c => c.NzbsrusHash).Returns("MockedConfigValue");
Mocker.GetMock<IConfigService>().SetupGet(c => c.NzbsrusUId).Returns("MockedConfigValue");
Mocker.GetMock<ConfigService>().SetupGet(c => c.FileSharingTalkUid).Returns("MockedConfigValue");
Mocker.GetMock<ConfigService>().SetupGet(c => c.FileSharingTalkSecret).Returns("MockedConfigValue");
Mocker.GetMock<IConfigService>().SetupGet(c => c.FileSharingTalkUid).Returns("MockedConfigValue");
Mocker.GetMock<IConfigService>().SetupGet(c => c.FileSharingTalkSecret).Returns("MockedConfigValue");
Mocker.GetMock<ConfigService>().SetupGet(c => c.OmgwtfnzbsUsername).Returns("MockedConfigValue");
Mocker.GetMock<ConfigService>().SetupGet(c => c.OmgwtfnzbsApiKey).Returns("MockedConfigValue");
Mocker.GetMock<IConfigService>().SetupGet(c => c.OmgwtfnzbsUsername).Returns("MockedConfigValue");
Mocker.GetMock<IConfigService>().SetupGet(c => c.OmgwtfnzbsApiKey).Returns("MockedConfigValue");
}
[TestCase("nzbsrus.xml")]

View File

@ -22,7 +22,7 @@ namespace NzbDrone.Core.Test.JobTests
{
private void WithEnableBacklogSearching()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.EnableBacklogSearching).Returns(true);
Mocker.GetMock<IConfigService>().SetupGet(s => s.EnableBacklogSearching).Returns(true);
}
[Test]

View File

@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.JobTests
Mocker.GetMock<PostDownloadProvider>().Setup(s => s.ProcessDropFolder(path));
Mocker.Resolve<PostDownloadScanJob>().Start(MockNotification, new { Path = path });
Mocker.GetMock<ConfigService>().Verify(s => s.DownloadClientTvDirectory, Times.Never());
Mocker.GetMock<IConfigService>().Verify(s => s.DownloadClientTvDirectory, Times.Never());
}
[Test]
@ -53,10 +53,10 @@ namespace NzbDrone.Core.Test.JobTests
{
var path = @"C:\Test\Unsorted TV";
Mocker.GetMock<ConfigService>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
Mocker.GetMock<IConfigService>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
Mocker.Resolve<PostDownloadScanJob>().Start(MockNotification, null);
Mocker.GetMock<ConfigService>().Verify(s => s.DownloadClientTvDirectory, Times.Once());
Mocker.GetMock<IConfigService>().Verify(s => s.DownloadClientTvDirectory, Times.Once());
}
[Test]
@ -64,7 +64,7 @@ namespace NzbDrone.Core.Test.JobTests
{
var path = @"C:\Test\Unsorted TV";
Mocker.GetMock<ConfigService>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
Mocker.GetMock<IConfigService>().SetupGet(s => s.DownloadClientTvDirectory).Returns(path);
Mocker.Resolve<PostDownloadScanJob>().Start(MockNotification, null);
Mocker.GetMock<PostDownloadProvider>().Verify(s => s.ProcessDropFolder(path), Times.Once());

View File

@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.JobTests
{
private void WithEnableBacklogSearching()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.EnableBacklogSearching).Returns(true);
Mocker.GetMock<IConfigService>().SetupGet(s => s.EnableBacklogSearching).Returns(true);
}
[SetUp]

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Test.JobTests
{
public void WithMinutes(int minutes)
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.RssSyncInterval).Returns(minutes);
Mocker.GetMock<IConfigService>().SetupGet(s => s.RssSyncInterval).Returns(minutes);
}
[TestCase(10)]

View File

@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock<MediaFileProvider>()
.Setup(e => e.Delete(It.IsAny<int>()));
Mocker.GetMock<ConfigService>()
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.AutoIgnorePreviouslyDownloadedEpisodes)
.Returns(true);

View File

@ -27,7 +27,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
[SetUp]
public void Setup()
{
Mocker.GetMock<ConfigService>().SetupGet(c => c.BlackholeDirectory).Returns(blackHoleFolder);
Mocker.GetMock<IConfigService>().SetupGet(c => c.BlackholeDirectory).Returns(blackHoleFolder);
}

View File

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.NzbgetProviderTes
[SetUp]
public void Setup()
{
var fakeConfig = Mocker.GetMock<ConfigService>();
var fakeConfig = Mocker.GetMock<IConfigService>();
fakeConfig.SetupGet(c => c.NzbgetHost).Returns("192.168.5.55");
fakeConfig.SetupGet(c => c.NzbgetPort).Returns(6789);
fakeConfig.SetupGet(c => c.NzbgetUsername).Returns("nzbget");

View File

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.NzbgetProviderTes
[SetUp]
public void Setup()
{
var fakeConfig = Mocker.GetMock<ConfigService>();
var fakeConfig = Mocker.GetMock<IConfigService>();
fakeConfig.SetupGet(c => c.NzbgetHost).Returns("192.168.5.55");
fakeConfig.SetupGet(c => c.NzbgetPort).Returns(6789);
fakeConfig.SetupGet(c => c.NzbgetUsername).Returns("nzbget");

View File

@ -30,8 +30,8 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
{
nzbPath = pneumaticFolder + title + ".nzb";
Mocker.GetMock<ConfigService>().SetupGet(c => c.PneumaticDirectory).Returns(pneumaticFolder);
Mocker.GetMock<ConfigService>().SetupGet(c => c.DownloadClientTvDirectory).Returns(sabDrop);
Mocker.GetMock<IConfigService>().SetupGet(c => c.PneumaticDirectory).Returns(pneumaticFolder);
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadClientTvDirectory).Returns(sabDrop);
}
private void WithExistingFile()

View File

@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
string password = "pass";
string cat = "tv";
var fakeConfig = Mocker.GetMock<ConfigService>();
var fakeConfig = Mocker.GetMock<IConfigService>();
fakeConfig.SetupGet(c => c.SabHost).Returns(sabHost);
fakeConfig.SetupGet(c => c.SabPort).Returns(sabPort);
fakeConfig.SetupGet(c => c.SabApiKey).Returns(apikey);

View File

@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
[SetUp]
public void Setup()
{
var fakeConfig = Mocker.GetMock<ConfigService>();
var fakeConfig = Mocker.GetMock<IConfigService>();
fakeConfig.SetupGet(c => c.SabHost).Returns("192.168.5.55");
fakeConfig.SetupGet(c => c.SabPort).Returns(2222);
@ -210,11 +210,11 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
[Test]
public void downloadNzb_should_use_sabRecentTvPriority_when_recentEpisode_is_true()
{
Mocker.GetMock<ConfigService>()
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.SabRecentTvPriority)
.Returns(SabPriorityType.High);
Mocker.GetMock<ConfigService>()
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.SabBacklogTvPriority)
.Returns(SabPriorityType.Low);
@ -232,11 +232,11 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
[Test]
public void downloadNzb_should_use_sabBackogTvPriority_when_recentEpisode_is_false()
{
Mocker.GetMock<ConfigService>()
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.SabRecentTvPriority)
.Returns(SabPriorityType.High);
Mocker.GetMock<ConfigService>()
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.SabBacklogTvPriority)
.Returns(SabPriorityType.Low);

View File

@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
private void SetDownloadClient(DownloadClientType clientType)
{
Mocker.GetMock<ConfigService>()
Mocker.GetMock<IConfigService>()
.Setup(c => c.DownloadClient)
.Returns(clientType);
}
@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), true), Times.Never());
VerifyEventPublished(It.Is<EpisodeGrabbedEvent>(c => c.ParseResult == parseResult));
VerifyEventPublished<EpisodeGrabbedEvent>();
}
[TestCase(DownloadClientType.Sabnzbd)]

View File

@ -134,7 +134,7 @@ namespace NzbDrone.Core.Test.ProviderTests
.Build();
Mocker.GetMock<ConfigService>().Setup(e => e.SortingSeasonFolderFormat).Returns(seasonFolderFormat);
Mocker.GetMock<IConfigService>().Setup(e => e.SortingSeasonFolderFormat).Returns(seasonFolderFormat);
//Act
var result = Mocker.Resolve<MediaFileProvider>().CalculateFilePath(fakeSeries, 1, filename, ".mkv");

View File

@ -94,7 +94,7 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
private void WithUseBanners()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.MetadataUseBanners).Returns(true);
Mocker.GetMock<IConfigService>().SetupGet(s => s.MetadataUseBanners).Returns(true);
}
private void WithSingleEpisodeFile()

View File

@ -76,7 +76,7 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
private void WithUseBanners()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.MetadataUseBanners).Returns(true);
Mocker.GetMock<IConfigService>().SetupGet(s => s.MetadataUseBanners).Returns(true);
}
private void WithSpecials()

View File

@ -27,22 +27,22 @@ namespace NzbDrone.Core.Test.ProviderTests
{
private void WithSingleClient()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.PlexClientHosts)
Mocker.GetMock<IConfigService>().SetupGet(s => s.PlexClientHosts)
.Returns("localhost:3000");
}
private void WithMultipleClients()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.PlexClientHosts)
Mocker.GetMock<IConfigService>().SetupGet(s => s.PlexClientHosts)
.Returns("localhost:3000, 192.168.0.10:3000");
}
public void WithClientCredentials()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.PlexUsername)
Mocker.GetMock<IConfigService>().SetupGet(s => s.PlexUsername)
.Returns("plex");
Mocker.GetMock<ConfigService>().SetupGet(s => s.PlexPassword)
Mocker.GetMock<IConfigService>().SetupGet(s => s.PlexPassword)
.Returns("plex");
}

View File

@ -50,7 +50,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
[SetUp]
public void Setup()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(RecycleBin);
Mocker.GetMock<IConfigService>().SetupGet(s => s.RecycleBin).Returns(RecycleBin);
Mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectories(RecycleBin))
.Returns(new [] { @"C:\Test\RecycleBin\Folder1", @"C:\Test\RecycleBin\Folder2", @"C:\Test\RecycleBin\Folder3" });
@ -62,7 +62,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
[Test]
public void should_return_if_recycleBin_not_configured()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
Mocker.GetMock<IConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
Mocker.Resolve<RecycleBinProvider>().Cleanup();

View File

@ -29,12 +29,12 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
{
private void WithRecycleBin()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
Mocker.GetMock<IConfigService>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
}
private void WithoutRecycleBin()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
Mocker.GetMock<IConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
}
[Test]

View File

@ -29,12 +29,12 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
{
private void WithRecycleBin()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
Mocker.GetMock<IConfigService>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
}
private void WithoutRecycleBin()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
Mocker.GetMock<IConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
}
[Test]

View File

@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
[SetUp]
public void Setup()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(RecycleBin);
Mocker.GetMock<IConfigService>().SetupGet(s => s.RecycleBin).Returns(RecycleBin);
Mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectories(RecycleBin))
.Returns(new [] { @"C:\Test\RecycleBin\Folder1", @"C:\Test\RecycleBin\Folder2", @"C:\Test\RecycleBin\Folder3" });
@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
[Test]
public void should_return_if_recycleBin_not_configured()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
Mocker.GetMock<IConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
Mocker.Resolve<RecycleBinProvider>().Empty();

View File

@ -27,7 +27,7 @@ namespace NzbDrone.Core.Test.ProviderTests
[SetUp]
public void Setup()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.ServiceRootUrl)
Mocker.GetMock<IConfigService>().SetupGet(s => s.ServiceRootUrl)
.Returns("http://services.nzbdrone.com");
}

View File

@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test.ProviderTests
[SetUp]
public void Setup()
{
Mocker.GetMock<ConfigService>().SetupGet(s => s.ServiceRootUrl)
Mocker.GetMock<IConfigService>().SetupGet(s => s.ServiceRootUrl)
.Returns("http://services.nzbdrone.com");
WithRealDb();

View File

@ -23,7 +23,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
{
WithStrictMocker();
Mocker.GetMock<ConfigService>().SetupGet(c => c.UpdateUrl).Returns("http://update.nzbdrone.com/_test/");
Mocker.GetMock<IConfigService>().SetupGet(c => c.UpdateUrl).Returns("http://update.nzbdrone.com/_test/");
Mocker.Resolve<HttpProvider>();
}

View File

@ -297,7 +297,7 @@ namespace NzbDrone.Core.Test.ProviderTests
var header = "NzbDrone Test";
var message = "Test Message!";
var fakeConfig = Mocker.GetMock<ConfigService>();
var fakeConfig = Mocker.GetMock<IConfigService>();
fakeConfig.SetupGet(s => s.XbmcHosts).Returns("localhost:8080");
//var fakeUdpProvider = Mocker.GetMock<EventClient>();
@ -441,7 +441,7 @@ namespace NzbDrone.Core.Test.ProviderTests
//Setup
WithStrictMocker();
var fakeConfig = Mocker.GetMock<ConfigService>();
var fakeConfig = Mocker.GetMock<IConfigService>();
fakeConfig.SetupGet(s => s.XbmcHosts).Returns("localhost:8080");
var fakeEventClient = Mocker.GetMock<EventClientProvider>();

View File

@ -816,7 +816,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
WithRealDb();
Mocker.Resolve<TvDbProvider>();
Mocker.GetMock<ConfigService>()
Mocker.GetMock<IConfigService>()
.Setup(e => e.DefaultQualityProfile).Returns(1);
Db.Insert(Builder<QualityProfile>.CreateNew().Build());

View File

@ -101,9 +101,9 @@ namespace NzbDrone.Test.Common
return Path.Combine(Directory.GetCurrentDirectory(), "Files", fileName);
}
protected void VerifyEventPublished<TEvent>(TEvent message) where TEvent : IEvent
protected void VerifyEventPublished<TEvent>() where TEvent : IEvent
{
Mocker.GetMock<IEventAggregator>().Verify(c => c.Publish(message), Times.Once());
Mocker.GetMock<IEventAggregator>().Verify(c => c.Publish(It.IsAny<TEvent>()), Times.Once());
}
protected void VerifyEventNotPublished<TEvent>() where TEvent : IEvent