mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 04:22:30 +01:00
Added some blacklist tests
This commit is contained in:
parent
1684ad6e16
commit
f99573e334
@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Blacklisting;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.Test.Blacklisting
|
||||
{
|
||||
[TestFixture]
|
||||
public class BlacklistRepositoryFixture : DbTest<BlacklistRepository, Blacklist>
|
||||
{
|
||||
private Blacklist _blacklist;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_blacklist = new Blacklist
|
||||
{
|
||||
SeriesId = 12345,
|
||||
EpisodeIds = new List<int> {1},
|
||||
Quality = new QualityModel(Quality.Bluray720p),
|
||||
SourceTitle = "series.title.s01e01",
|
||||
Date = DateTime.UtcNow
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_able_to_write_to_database()
|
||||
{
|
||||
Subject.Insert(_blacklist);
|
||||
Subject.All().Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_should_have_episode_ids()
|
||||
{
|
||||
Subject.Insert(_blacklist);
|
||||
|
||||
Subject.All().First().EpisodeIds.Should().Contain(_blacklist.EpisodeIds);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_check_for_blacklisted_title_case_insensative()
|
||||
{
|
||||
Subject.Insert(_blacklist);
|
||||
|
||||
Subject.Blacklisted(_blacklist.SourceTitle.ToUpperInvariant()).Should().BeTrue();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Blacklisting;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.Test.Blacklisting
|
||||
{
|
||||
[TestFixture]
|
||||
public class BlacklistServiceFixture : CoreTest<BlacklistService>
|
||||
{
|
||||
private DownloadFailedEvent _event;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_event = new DownloadFailedEvent
|
||||
{
|
||||
SeriesId = 12345,
|
||||
EpisodeIds = new List<int> {1},
|
||||
Quality = new QualityModel(Quality.Bluray720p),
|
||||
SourceTitle = "series.title.s01e01",
|
||||
DownloadClient = "SabnzbdClient",
|
||||
DownloadClientId = "Sabnzbd_nzo_2dfh73k"
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_trigger_redownload()
|
||||
{
|
||||
Subject.Handle(_event);
|
||||
|
||||
Mocker.GetMock<IRedownloadFailedDownloads>()
|
||||
.Verify(v => v.Redownload(_event.SeriesId, _event.EpisodeIds), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_add_to_repository()
|
||||
{
|
||||
Subject.Handle(_event);
|
||||
|
||||
Mocker.GetMock<IBlacklistRepository>()
|
||||
.Verify(v => v.Insert(It.Is<Blacklist>(b => b.EpisodeIds == _event.EpisodeIds)), Times.Once());
|
||||
}
|
||||
}
|
||||
}
|
@ -99,6 +99,8 @@
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Blacklisting\BlacklistServiceFixture.cs" />
|
||||
<Compile Include="Blacklisting\BlacklistRepositoryFixture.cs" />
|
||||
<Compile Include="DataAugmentationFixture\Scene\SceneMappingProxyFixture.cs" />
|
||||
<Compile Include="DataAugmentationFixture\Scene\SceneMappingServiceFixture.cs" />
|
||||
<Compile Include="Datastore\BasicRepositoryFixture.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user