mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 05:23:31 -07:00
Fixed a bug where reports weren't being added to history
This commit is contained in:
parent
f3be5fa08e
commit
500e9af6c3
18 changed files with 344 additions and 225 deletions
55
NzbDrone.Core.Test/DownloadProviderTest.cs
Normal file
55
NzbDrone.Core.Test/DownloadProviderTest.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using Gallio.Framework;
|
||||
using MbUnit.Framework;
|
||||
using MbUnit.Framework.ContractVerifiers;
|
||||
using Moq;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
public class DownloadProviderTest
|
||||
{
|
||||
[Test]
|
||||
public void Download_report_should_send_to_sab_and_add_to_history()
|
||||
{
|
||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
var parseResult = Builder<EpisodeParseResult>.CreateNew()
|
||||
.With(e => e.Episodes = Builder<Episode>.CreateListOfSize(2)
|
||||
.WhereTheFirst(1).Has(s => s.EpisodeId = 12)
|
||||
.AndTheNext(1).Has(s => s.EpisodeId = 99)
|
||||
.Build())
|
||||
.Build();
|
||||
|
||||
const string sabTitle = "My fake sab title";
|
||||
mocker.GetMock<SabProvider>()
|
||||
.Setup(s => s.IsInQueue(It.IsAny<String>()))
|
||||
.Returns(false);
|
||||
|
||||
mocker.GetMock<SabProvider>()
|
||||
.Setup(s => s.AddByUrl(parseResult.NzbUrl, sabTitle))
|
||||
.Returns(true);
|
||||
|
||||
mocker.GetMock<SabProvider>()
|
||||
.Setup(s => s.GetSabTitle(parseResult))
|
||||
.Returns(sabTitle);
|
||||
|
||||
mocker.GetMock<HistoryProvider>()
|
||||
.Setup(s => s.Add(It.Is<History>(h=>h.EpisodeId == 12)));
|
||||
mocker.GetMock<HistoryProvider>()
|
||||
.Setup(s => s.Add(It.Is<History>(h => h.EpisodeId == 99)));
|
||||
|
||||
mocker.Resolve<DownloadProvider>().DownloadReport(parseResult);
|
||||
|
||||
|
||||
mocker.VerifyAllMocks();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue