2013-02-20 05:05:15 +03:00
|
|
|
using System.Linq;
|
2011-05-22 19:53:21 +03:00
|
|
|
using FizzWare.NBuilder;
|
2011-06-03 00:06:46 +03:00
|
|
|
using FluentAssertions;
|
2013-02-20 05:05:15 +03:00
|
|
|
using Moq;
|
2011-06-03 00:06:46 +03:00
|
|
|
using NUnit.Framework;
|
2013-02-24 09:48:52 +03:00
|
|
|
using NzbDrone.Core.Configuration;
|
2013-05-21 01:45:16 +03:00
|
|
|
using NzbDrone.Core.RootFolders;
|
2013-02-19 09:01:03 +03:00
|
|
|
using NzbDrone.Core.Tv;
|
2011-05-19 06:55:35 +03:00
|
|
|
using NzbDrone.Core.Test.Framework;
|
2013-05-21 01:45:16 +03:00
|
|
|
using NzbDrone.Core.Tv.Events;
|
2011-05-22 19:53:21 +03:00
|
|
|
|
2013-02-19 09:01:03 +03:00
|
|
|
namespace NzbDrone.Core.Test.TvTests
|
2011-05-22 19:53:21 +03:00
|
|
|
{
|
|
|
|
[TestFixture]
|
2013-05-21 01:45:16 +03:00
|
|
|
public class SeriesServiceFixture : CoreTest<SeriesService>
|
2011-05-22 19:53:21 +03:00
|
|
|
{
|
2013-02-20 05:05:15 +03:00
|
|
|
private Mock<ISeriesRepository> Repo;
|
|
|
|
|
|
|
|
private Series fakeSeries;
|
|
|
|
|
2012-10-14 03:54:46 +03:00
|
|
|
[SetUp]
|
|
|
|
public void Setup()
|
|
|
|
{
|
2013-02-20 05:05:15 +03:00
|
|
|
Repo = Mocker.GetMock<ISeriesRepository>();
|
|
|
|
fakeSeries = Builder<Series>.CreateNew().Build();
|
2012-10-14 03:54:46 +03:00
|
|
|
}
|
|
|
|
|
2013-05-21 01:45:16 +03:00
|
|
|
[Test]
|
|
|
|
public void series_added_event_should_have_proper_path()
|
2011-05-22 19:53:21 +03:00
|
|
|
{
|
2013-05-24 07:10:56 +03:00
|
|
|
fakeSeries.Path = null;
|
|
|
|
fakeSeries.RootFolderPath = @"C:\Test\TV";
|
2011-06-18 10:17:47 +03:00
|
|
|
|
2013-05-21 01:45:16 +03:00
|
|
|
var series = Subject.AddSeries(fakeSeries);
|
2011-06-18 10:17:47 +03:00
|
|
|
|
2013-05-24 07:10:56 +03:00
|
|
|
series.Path.Should().NotBeNull();
|
2011-06-18 10:17:47 +03:00
|
|
|
|
2013-05-21 01:45:16 +03:00
|
|
|
VerifyEventPublished<SeriesAddedEvent>();
|
2011-06-18 10:17:47 +03:00
|
|
|
}
|
|
|
|
|
2011-05-22 19:53:21 +03:00
|
|
|
[Test]
|
|
|
|
public void is_monitored()
|
|
|
|
{
|
2013-02-20 05:05:15 +03:00
|
|
|
Repo.Setup(c => c.Get(12))
|
|
|
|
.Returns(fakeSeries);
|
2012-02-28 08:50:56 +03:00
|
|
|
|
2013-02-20 05:05:15 +03:00
|
|
|
fakeSeries.Monitored = true;
|
2012-02-28 08:50:56 +03:00
|
|
|
|
2013-02-20 05:05:15 +03:00
|
|
|
Subject.IsMonitored(12).Should().Be(true);
|
2012-02-28 08:50:56 +03:00
|
|
|
}
|
2011-05-22 19:53:21 +03:00
|
|
|
}
|
2011-04-23 01:24:05 +03:00
|
|
|
} |