1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-27 10:17:47 +00:00
Sonarr/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/GetEpisodeBySceneNumberFixture.cs

76 lines
2 KiB
C#
Raw Normal View History

// ReSharper disable RedundantUsingDirective
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.EpisodeProviderTests
{
[TestFixture]
// ReSharper disable InconsistentNaming
2013-03-24 04:16:00 +00:00
public class GetEpisodeBySceneNumberFixture : DbTest
{
private Series _series;
private Episode _episode;
[SetUp]
public void Setup()
{
2013-03-02 18:25:39 +00:00
_series = Builder<Series>
.CreateNew()
.Build();
Db.Insert(_series);
}
public void WithNullSceneNumbering()
{
_episode = Builder<Episode>
.CreateNew()
.With(e => e.SeriesId = _series.Id)
.Build();
Db.Insert(_episode);
}
public void WithSceneNumbering()
{
_episode = Builder<Episode>
.CreateNew()
.With(e => e.SeriesId = _series.Id)
.Build();
Db.Insert(_episode);
}
[Test]
public void should_return_null_if_no_episodes_in_db()
{
Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.Id, 1, 1).Should().BeNull();
}
[Test]
public void should_return_null_if_no_matching_episode_is_found()
{
WithNullSceneNumbering();
Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.Id, 1, 1).Should().BeNull();
}
[Test]
public void should_return_episode_if_matching_episode_is_found()
{
WithSceneNumbering();
var result = Mocker.Resolve<EpisodeService>()
.GetEpisodeBySceneNumbering(_series.Id, _episode.SceneSeasonNumber, _episode.SceneEpisodeNumber);
result.Id.Should().Be(_episode.Id);
}
}
}