1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-23 22:25:56 -04:00

New: Renamed Blacklist to Blocklist

This commit is contained in:
Robin Dadswell
2021-07-08 23:27:23 +01:00
committed by Mark McDowall
parent 2f6409226a
commit ead1371846
39 changed files with 405 additions and 305 deletions
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Download;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Blocklisting
{
[TestFixture]
public class BlocklistServiceFixture : CoreTest<BlocklistService>
{
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",
DownloadId = "Sabnzbd_nzo_2dfh73k"
};
_event.Data.Add("publishedDate", DateTime.UtcNow.ToString("s") + "Z");
_event.Data.Add("size", "1000");
_event.Data.Add("indexer", "nzbs.org");
_event.Data.Add("protocol", "1");
_event.Data.Add("message", "Marked as failed");
}
[Test]
public void should_add_to_repository()
{
Subject.Handle(_event);
Mocker.GetMock<IBlocklistRepository>()
.Verify(v => v.Insert(It.Is<Blocklist>(b => b.EpisodeIds == _event.EpisodeIds)), Times.Once());
}
[Test]
public void should_add_to_repository_missing_size_and_protocol()
{
Subject.Handle(_event);
_event.Data.Remove("size");
_event.Data.Remove("protocol");
Mocker.GetMock<IBlocklistRepository>()
.Verify(v => v.Insert(It.Is<Blocklist>(b => b.EpisodeIds == _event.EpisodeIds)), Times.Once());
}
}
}