2013-04-20 23:13:57 +03:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using FluentAssertions;
|
|
|
|
using NUnit.Framework;
|
2013-04-21 02:36:23 +03:00
|
|
|
using NzbDrone.Core.SeriesStats;
|
2013-04-20 23:13:57 +03:00
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
|
2013-04-21 02:36:23 +03:00
|
|
|
namespace NzbDrone.Core.Test.SeriesStatsTests
|
2013-04-20 23:13:57 +03:00
|
|
|
{
|
|
|
|
[TestFixture]
|
2013-04-21 02:36:23 +03:00
|
|
|
public class SeriesStatisticsFixture : DbTest<SeriesStatisticsRepository, Series>
|
2013-04-20 23:13:57 +03:00
|
|
|
{
|
|
|
|
private Episode _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;
|
|
|
|
|
|
|
|
_episode = Builder<Episode>.CreateNew()
|
|
|
|
.With(e => e.Id = 0)
|
|
|
|
.With(e => e.SeriesId = series.Id)
|
2013-07-26 06:25:24 +03:00
|
|
|
.With(e => e.AirDateUtc = DateTime.Today.AddDays(5))
|
2013-04-20 23:13:57 +03:00
|
|
|
.Build();
|
|
|
|
|
|
|
|
Db.Insert(_episode);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2013-04-21 02:36:23 +03:00
|
|
|
public void should_get_stats_for_series()
|
2013-04-20 23:13:57 +03:00
|
|
|
{
|
|
|
|
var stats = Subject.SeriesStatistics();
|
|
|
|
|
|
|
|
stats.Should().HaveCount(1);
|
2013-07-26 06:25:24 +03:00
|
|
|
stats.First().NextAiring.Should().Be(_episode.AirDateUtc);
|
2013-04-20 23:13:57 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|