sonarr-repo-only/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs

70 lines
2.6 KiB
C#
Raw Normal View History

2013-04-20 17:28:17 +00:00
using System;
using System.Collections.Generic;
2013-05-02 05:50:34 +00:00
using System.ComponentModel;
2013-04-20 17:28:17 +00:00
using System.Linq;
using System.Text;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
2013-05-02 05:50:34 +00:00
using NzbDrone.Core.Datastore;
2013-04-20 17:28:17 +00:00
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
{
[TestFixture]
public class EpisodesWithoutFilesFixture : DbTest<EpisodeRepository, Episode>
{
[SetUp]
public void Setup()
{
var series = Builder<Series>.CreateNew()
.With(s => s.Id = 0)
.With(s => s.Runtime = 30)
.Build();
series.Id = Db.Insert(series).Id;
var episodes = Builder<Episode>.CreateListOfSize(2)
.All()
.With(e => e.Id = 0)
.With(e => e.SeriesId = series.Id)
.With(e => e.EpisodeFileId = 0)
.TheLast(1)
.With(e => e.SeasonNumber = 0)
.Build();
Db.InsertMany(episodes);
}
[Test]
public void should_get_episodes()
{
2013-05-02 05:50:34 +00:00
var episodes =
Subject.EpisodesWithoutFiles(new PagingSpec<Episode>
{
Page = 1,
PageSize = 10,
SortKey = "AirDate",
SortDirection = ListSortDirection.Ascending
}, false);
episodes.Records.Should().HaveCount(1);
2013-04-20 17:28:17 +00:00
}
[Test]
2013-05-02 05:50:34 +00:00
[Ignore("Specials not implemented")]
2013-04-20 17:28:17 +00:00
public void should_get_episode_including_specials()
{
2013-05-02 05:50:34 +00:00
var episodes =
Subject.EpisodesWithoutFiles(new PagingSpec<Episode>
{
Page = 1,
PageSize = 10,
SortKey = "AirDate",
SortDirection = ListSortDirection.Ascending
}, true);
episodes.Records.Should().HaveCount(2);
2013-04-20 17:28:17 +00:00
}
}
}