1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Core.Test/TvTests/SeasonProviderTest.cs

58 lines
1.7 KiB
C#
Raw Normal View History

2013-07-19 06:47:55 +03:00
using System.Linq;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.TvTests
{
2013-03-28 09:49:38 +03:00
public class SeasonProviderTest : DbTest<SeasonRepository, Season>
{
[TestCase(true)]
[TestCase(false)]
public void Ismonitored_should_return_monitored_status_of_season(bool monitored)
{
var fakeSeason = Builder<Season>.CreateNew()
.With(s => s.Monitored = monitored)
2013-03-28 09:49:38 +03:00
.BuildNew<Season>();
Db.Insert(fakeSeason);
var result = Subject.IsMonitored(fakeSeason.SeriesId, fakeSeason.SeasonNumber);
result.Should().Be(monitored);
}
[Test]
public void Monitored_should_return_true_if_not_in_db()
{
Subject.IsMonitored(10, 0).Should().BeTrue();
}
[Test]
public void GetSeason_should_return_seasons_for_specified_series_only()
{
var seriesA = new[] { 1, 2, 3 };
var seriesB = new[] { 4, 5, 6 };
2013-03-28 09:49:38 +03:00
var seasonsA = seriesA.Select(c => new Season {SeasonNumber = c, SeriesId = 1}).ToList();
var seasonsB = seriesB.Select(c => new Season {SeasonNumber = c, SeriesId = 2}).ToList();
Subject.InsertMany(seasonsA);
Subject.InsertMany(seasonsB);
Subject.GetSeasonNumbers(1).Should().Equal(seriesA);
Subject.GetSeasonNumbers(2).Should().Equal(seriesB);
}
[Test]
public void GetSeason_should_return_emptylist_if_series_doesnt_exist()
{
2013-03-28 09:49:38 +03:00
Subject.GetSeasonNumbers(1).Should().BeEmpty();
}
}
}