1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 10:32:35 +01:00
Radarr/NzbDrone.Core.Test/TvTests/SeriesProviderTest.cs

83 lines
3.3 KiB
C#
Raw Normal View History

using System.Linq;
2011-05-22 18:53:21 +02:00
using FizzWare.NBuilder;
2011-06-02 23:06:46 +02:00
using FluentAssertions;
using Moq;
2011-06-02 23:06:46 +02:00
using NUnit.Framework;
2013-02-24 07:48:52 +01:00
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Test.Framework;
2011-05-22 18:53:21 +02:00
namespace NzbDrone.Core.Test.TvTests
2011-05-22 18:53:21 +02:00
{
[TestFixture]
public class SeriesProviderTest : CoreTest<SeriesService>
2011-05-22 18:53:21 +02:00
{
private Mock<ISeriesRepository> Repo;
private Series fakeSeries;
2012-10-14 02:54:46 +02:00
[SetUp]
public void Setup()
{
Repo = Mocker.GetMock<ISeriesRepository>();
fakeSeries = Builder<Series>.CreateNew().Build();
2012-10-14 02:54:46 +02:00
}
2013-03-31 23:45:16 +02:00
/* [Test]
public void Add_new_series()
2011-05-22 18:53:21 +02:00
{
const string path = "C:\\Test\\";
2012-02-29 09:25:41 +01:00
const string title = "Test Title";
2011-05-22 18:53:21 +02:00
const int tvDbId = 1234;
const int qualityProfileId = 2;
Series insertedModel = null;
Repo.Setup(c => c.Insert(It.IsAny<Series>()))
.Callback<Series>(c => insertedModel = c);
Subject.AddSeries(title, path, tvDbId, qualityProfileId, null);
insertedModel.Should().NotBeNull();
insertedModel.Path.Should().Be(path);
2013-03-28 07:49:38 +01:00
insertedModel.TvDbId.Should().Be(tvDbId);
insertedModel.QualityProfileId.Should().Be(qualityProfileId);
insertedModel.Title.Should().Be(title);
}
[TestCase(true)]
[TestCase(false)]
public void Add_new_series_should_use_config_for_season_folders(bool useSeasonFolder)
2011-05-22 18:53:21 +02:00
{
2013-02-24 20:39:31 +01:00
Mocker.GetMock<IConfigService>()
.Setup(c => c.UseSeasonFolder).Returns(useSeasonFolder);
2011-05-22 18:53:21 +02:00
const string path = "C:\\Test\\";
const string title = "Test Title";
const int tvDbId = 1234;
const int qualityProfileId = 2;
2011-12-15 05:29:21 +01:00
Series insertedModel = null;
2011-12-15 05:29:21 +01:00
Repo.Setup(c => c.Insert(It.IsAny<Series>()))
.Callback<Series>(c => insertedModel = c);
Subject.AddSeries(title, path, tvDbId, qualityProfileId, null);
2011-05-22 18:53:21 +02:00
insertedModel.SeasonFolder = useSeasonFolder;
2013-03-31 23:45:16 +02:00
}*/
2011-05-22 18:53:21 +02:00
[Test]
public void is_monitored()
{
Repo.Setup(c => c.Get(12))
.Returns(fakeSeries);
fakeSeries.Monitored = true;
Subject.IsMonitored(12).Should().Be(true);
}
2011-05-22 18:53:21 +02:00
}
}