Fixed episodesWithoutFiles

This commit is contained in:
Mark McDowall 2013-04-20 10:28:17 -07:00
parent c0798b8eb3
commit acb15d8e49
4 changed files with 54 additions and 3 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -154,6 +154,7 @@
<Compile Include="ProviderTests\RecycleBinProviderTests\DeleteFileFixture.cs" />
<Compile Include="ProviderTests\RecycleBinProviderTests\DeleteDirectoryFixture.cs" />
<Compile Include="ProviderTests\PlexProviderTest.cs" />
<Compile Include="TvTests\EpisodeRepositoryTests\EpisodesWithoutFilesFixture.cs" />
<Compile Include="TvTests\EpisodeRepositoryTests\EpisodesBetweenDatesFixture.cs" />
<Compile Include="TvTests\SeasonProviderTest.cs" />
<Compile Include="DecisionEngineTests\RetentionSpecificationFixture.cs" />

View File

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
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()
{
var episodes = Subject.EpisodesWithoutFiles(false);
episodes.Should().HaveCount(1);
}
[Test]
public void should_get_episode_including_specials()
{
var episodes = Subject.EpisodesWithoutFiles(true);
episodes.Should().HaveCount(2);
}
}
}

View File

@ -14,8 +14,6 @@ namespace NzbDrone.Core.Tv
public int SeasonNumber { get; set; }
public int EpisodeNumber { get; set; }
public string Title { get; set; }
//Todo: Since we're displaying next airing relative to the user's time zone we may want to store this as UTC (with airtime + UTC offset)
public DateTime? AirDate { get; set; }
public string Overview { get; set; }