mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02:00
Updated tests to for Upcoming Provider to make sure a series is returned.
This commit is contained in:
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 @@ public class UpcomingEpisodesProviderTest : TestBase
|
||||
private Episode tomorrow;
|
||||
private Episode twoDays;
|
||||
private Episode sevenDays;
|
||||
private Series series;
|
||||
|
||||
[SetUp]
|
||||
public new void Setup()
|
||||
@ -25,33 +28,41 @@ public class UpcomingEpisodesProviderTest : TestBase
|
||||
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 @@ public void Get_Yesterday()
|
||||
database.Insert(tomorrow);
|
||||
database.Insert(twoDays);
|
||||
database.Insert(sevenDays);
|
||||
database.Insert(series);
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<UpcomingEpisodesProvider>().Yesterday();
|
||||
@ -75,6 +87,8 @@ public void Get_Yesterday()
|
||||
//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 @@ public void Get_Today()
|
||||
database.Insert(tomorrow);
|
||||
database.Insert(twoDays);
|
||||
database.Insert(sevenDays);
|
||||
database.Insert(series);
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<UpcomingEpisodesProvider>().Today();
|
||||
@ -97,6 +112,8 @@ public void Get_Today()
|
||||
//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 @@ public void Get_Tomorrow()
|
||||
database.Insert(tomorrow);
|
||||
database.Insert(twoDays);
|
||||
database.Insert(sevenDays);
|
||||
database.Insert(series);
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<UpcomingEpisodesProvider>().Tomorrow();
|
||||
@ -119,6 +137,8 @@ public void Get_Tomorrow()
|
||||
//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 @@ public void Get_Week()
|
||||
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…
Reference in New Issue
Block a user