mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
cleaned up parsing logic and structure.
This commit is contained in:
parent
cd2761d07d
commit
6e88f55a54
120 changed files with 2149 additions and 3064 deletions
|
@ -1,30 +1,24 @@
|
|||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
[TestFixture]
|
||||
|
||||
public class MonitoredEpisodeSpecificationFixture : CoreTest
|
||||
|
||||
public class MonitoredEpisodeSpecificationFixture : CoreTest<MonitoredEpisodeSpecification>
|
||||
{
|
||||
private MonitoredEpisodeSpecification monitoredEpisodeSpecification;
|
||||
|
||||
private IndexerParseResult parseResultMulti;
|
||||
private IndexerParseResult parseResultSingle;
|
||||
private RemoteEpisode parseResultMulti;
|
||||
private RemoteEpisode parseResultSingle;
|
||||
private Series fakeSeries;
|
||||
private Episode firstEpisode;
|
||||
private Episode secondEpisode;
|
||||
|
@ -38,33 +32,26 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
.With(c => c.Monitored = true)
|
||||
.Build();
|
||||
|
||||
parseResultMulti = new IndexerParseResult
|
||||
|
||||
var singleEpisodeList = new List<Episode> { firstEpisode };
|
||||
var doubleEpisodeList = new List<Episode> { firstEpisode, secondEpisode };
|
||||
|
||||
parseResultMulti = new RemoteEpisode
|
||||
{
|
||||
SeriesTitle = "Title",
|
||||
Series = fakeSeries,
|
||||
EpisodeNumbers = new List<int> { 3, 4 },
|
||||
SeasonNumber = 12,
|
||||
Episodes = doubleEpisodeList
|
||||
};
|
||||
|
||||
parseResultSingle = new IndexerParseResult
|
||||
parseResultSingle = new RemoteEpisode
|
||||
{
|
||||
SeriesTitle = "Title",
|
||||
Series = fakeSeries,
|
||||
EpisodeNumbers = new List<int> { 3 },
|
||||
SeasonNumber = 12,
|
||||
Episodes = singleEpisodeList
|
||||
};
|
||||
|
||||
firstEpisode = new Episode { Ignored = false };
|
||||
secondEpisode = new Episode { Ignored = false };
|
||||
|
||||
var singleEpisodeList = new List<Episode> { firstEpisode };
|
||||
var doubleEpisodeList = new List<Episode> { firstEpisode, secondEpisode };
|
||||
|
||||
Mocker.GetMock<IEpisodeService>().Setup(c => c.GetEpisodesByParseResult(parseResultSingle)).Returns(singleEpisodeList);
|
||||
Mocker.GetMock<IEpisodeService>().Setup(c => c.GetEpisodesByParseResult(parseResultMulti)).Returns(doubleEpisodeList);
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(c => c.GetByTitle(parseResultMulti.CleanTitle)).Returns(fakeSeries);
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(c => c.GetByTitle(parseResultSingle.CleanTitle)).Returns(fakeSeries);
|
||||
}
|
||||
|
||||
private void WithFirstEpisodeIgnored()
|
||||
|
@ -97,7 +84,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
public void not_in_db_should_be_skipped()
|
||||
{
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
.Setup(p => p.GetByTitle(It.IsAny<String>()))
|
||||
.Setup(p => p.FindByTitle(It.IsAny<String>()))
|
||||
.Returns<Series>(null);
|
||||
|
||||
monitoredEpisodeSpecification.IsSatisfiedBy(parseResultMulti).Should().BeFalse();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue