Updated tests to for Upcoming Provider to make sure a series is returned.

pull/4/head
Mark McDowall 14 years ago
parent 86ab26e2d9
commit 5a99d374d9

@ -1,7 +1,9 @@
// ReSharper disable RedundantUsingDirective
using System;
using System.Collections.Generic;
using AutoMoq;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
@ -18,6 +20,7 @@ namespace NzbDrone.Core.Test
private Episode tomorrow;
private Episode twoDays;
private Episode sevenDays;
private Series series;
[SetUp]
public new void Setup()
@ -25,33 +28,41 @@ namespace NzbDrone.Core.Test
yesterday = Builder<Episode>.CreateNew()
.With(c => c.AirDate = DateTime.Today.AddDays(-1))
.With(c => c.Title = "Yesterday")
.With(c => c.SeriesId = 1)
.Build();
today = Builder<Episode>.CreateNew()
.With(c => c.AirDate = DateTime.Today)
.With(c => c.Title = "Today")
.With(c => c.SeriesId = 1)
.Build();
tomorrow = Builder<Episode>.CreateNew()
.With(c => c.AirDate = DateTime.Today.AddDays(1))
.With(c => c.Title = "Tomorrow")
.With(c => c.SeriesId = 1)
.Build();
twoDays = Builder<Episode>.CreateNew()
.With(c => c.AirDate = DateTime.Today.AddDays(2))
.With(c => c.Title = "Two Days")
.With(c => c.SeriesId = 1)
.Build();
sevenDays = Builder<Episode>.CreateNew()
.With(c => c.AirDate = DateTime.Today.AddDays(7))
.With(c => c.Title = "Seven Days")
.With(c => c.SeriesId = 1)
.Build();
sevenDays = Builder<Episode>.CreateNew()
.With(c => c.AirDate = DateTime.Today.AddDays(8))
.With(c => c.Title = "Eight Days")
.With(c => c.SeriesId = 1)
.Build();
series = Builder<Series>.CreateNew().With(s => s.SeriesId = 1).Build();
base.Setup();
}
@ -68,6 +79,7 @@ namespace NzbDrone.Core.Test
database.Insert(tomorrow);
database.Insert(twoDays);
database.Insert(sevenDays);
database.Insert(series);
//Act
var result = mocker.Resolve<UpcomingEpisodesProvider>().Yesterday();
@ -75,6 +87,8 @@ namespace NzbDrone.Core.Test
//Assert
Assert.AreEqual(1, result.Count);
Assert.AreEqual(yesterday.Title, result[0].Title);
result[0].Series.Should().NotBeNull();
result[0].Series.SeriesId.Should().NotBe(0);
}
[Test]
@ -90,6 +104,7 @@ namespace NzbDrone.Core.Test
database.Insert(tomorrow);
database.Insert(twoDays);
database.Insert(sevenDays);
database.Insert(series);
//Act
var result = mocker.Resolve<UpcomingEpisodesProvider>().Today();
@ -97,6 +112,8 @@ namespace NzbDrone.Core.Test
//Assert
Assert.AreEqual(1, result.Count);
Assert.AreEqual(today.Title, result[0].Title);
result[0].Series.Should().NotBeNull();
result[0].Series.SeriesId.Should().NotBe(0);
}
[Test]
@ -112,6 +129,7 @@ namespace NzbDrone.Core.Test
database.Insert(tomorrow);
database.Insert(twoDays);
database.Insert(sevenDays);
database.Insert(series);
//Act
var result = mocker.Resolve<UpcomingEpisodesProvider>().Tomorrow();
@ -119,6 +137,8 @@ namespace NzbDrone.Core.Test
//Assert
Assert.AreEqual(1, result.Count);
Assert.AreEqual(tomorrow.Title, result[0].Title);
result[0].Series.Should().NotBeNull();
result[0].Series.SeriesId.Should().NotBe(0);
}
[Test]
@ -134,12 +154,17 @@ namespace NzbDrone.Core.Test
database.Insert(tomorrow);
database.Insert(twoDays);
database.Insert(sevenDays);
database.Insert(series);
//Act
var result = mocker.Resolve<UpcomingEpisodesProvider>().Week();
//Assert
Assert.AreEqual(2, result.Count);
result[0].Series.Should().NotBeNull();
result[0].Series.SeriesId.Should().NotBe(0);
result[1].Series.Should().NotBeNull();
result[1].Series.SeriesId.Should().NotBe(0);
}
}
}

Loading…
Cancel
Save