1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

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 @@ public void Setup()
[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 @@ public void Setup()
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 @@ public class IndexerFixture : CoreTest
{
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 @@ public class BacklogSearchJobTest : CoreTest<BacklogSearchJob>
{
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 @@ public void should_not_get_sabDropDir_when_path_is_supplied()
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 @@ public void should_get_sabDropDir_when_path_is_not_supplied()
{
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 @@ public void should_use_sabDropDir_when_options_Path_is_not_provided()
{
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 @@ public class RecentBacklogSearchJobTest : CoreTest
{
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 @@ public class RssSyncJobTest : CoreTest
{
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 @@ public void should_delete_none_existing_files_remove_links_to_episodes()
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 @@ public class BlackholeProviderFixture : CoreTest
[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 @@ public class DownloadNzbFixture : TestBase
[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 @@ public class QueueFixture : TestBase
[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 @@ public void Setup()
{
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 @@ public void Setup()
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 @@ public class SabProviderFixture : CoreTest
[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 @@ public void should_return_false_when_WebException_is_thrown()
[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 @@ public void downloadNzb_should_use_sabRecentTvPriority_when_recentEpisode_is_tru
[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 @@ public class DownloadProviderFixture : CoreTest<DownloadProvider>
private void SetDownloadClient(DownloadClientType clientType)
{
Mocker.GetMock<ConfigService>()
Mocker.GetMock<IConfigService>()
.Setup(c => c.DownloadClient)
.Returns(clientType);
}
@ -90,7 +90,7 @@ public void Download_report_should_publish_on_grab_event()
.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 @@ public void CalculateFilePath_SeasonFolder_SingleNumber(string filename, int sea
.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 @@ public void Setup()
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 @@ public void Setup()
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 @@ public class PlexProviderTest : CoreTest
{
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 @@ private void WithNonExpired()
[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 @@ public void Setup()
[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 @@ public class DeleteDirectoryFixture : CoreTest
{
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 @@ public class DeleteFileFixture : CoreTest
{
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 @@ public class EmptyFixture : CoreTest
[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 @@ public void Setup()
[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 @@ public class ReferenceDataProviderTest : SqlCeTest
[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 @@ public class SceneMappingProviderTest : SqlCeTest
[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 @@ public void Setup()
{
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 @@ public void Notify_true()
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 @@ public void Clean()
//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 @@ public void Add_daily_show_episodes()
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 @@ protected string GetTestFilePath(string fileName)
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