mirror of
https://github.com/jellyfin/TMDbLib.git
synced 2024-11-23 05:40:12 +00:00
Reorder a test a little, fix spelling mistake
This commit is contained in:
parent
f8b7248193
commit
0b6a7c5cd1
@ -6,134 +6,145 @@ using TMDbLib.Objects.General;
|
||||
|
||||
namespace TMDbLibTests
|
||||
{
|
||||
[TestClass]
|
||||
public class ClientChangesTests
|
||||
{
|
||||
private TestConfig _config;
|
||||
[TestClass]
|
||||
public class ClientChangesTests
|
||||
{
|
||||
private TestConfig _config;
|
||||
|
||||
/// <summary>
|
||||
/// Run once, on every test
|
||||
/// </summary>
|
||||
[TestInitialize]
|
||||
public void Initiator()
|
||||
{
|
||||
_config = new TestConfig();
|
||||
}
|
||||
/// <summary>
|
||||
/// Run once, on every test
|
||||
/// </summary>
|
||||
[TestInitialize]
|
||||
public void Initiator()
|
||||
{
|
||||
_config = new TestConfig();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestChangesMovies()
|
||||
{
|
||||
// Basic check
|
||||
SearchContainer<ChangesListItem> changesPage1 = _config.Client.GetChangesMovies();
|
||||
[TestMethod]
|
||||
public void TestChangesMovies()
|
||||
{
|
||||
// Basic check
|
||||
SearchContainer<ChangesListItem> changesPage1 = _config.Client.GetChangesMovies();
|
||||
|
||||
Assert.IsNotNull(changesPage1);
|
||||
Assert.IsTrue(changesPage1.Results.Count > 0);
|
||||
Assert.IsTrue(changesPage1.TotalResults > changesPage1.Results.Count);
|
||||
Assert.AreEqual(1, changesPage1.Page);
|
||||
Assert.IsNotNull(changesPage1);
|
||||
Assert.IsTrue(changesPage1.Results.Count > 0);
|
||||
Assert.IsTrue(changesPage1.TotalResults > changesPage1.Results.Count);
|
||||
Assert.AreEqual(1, changesPage1.Page);
|
||||
|
||||
// Page 2
|
||||
SearchContainer<ChangesListItem> changesPage2 = _config.Client.GetChangesMovies(2);
|
||||
// Page 2
|
||||
SearchContainer<ChangesListItem> changesPage2 = _config.Client.GetChangesMovies(2);
|
||||
|
||||
Assert.IsNotNull(changesPage2);
|
||||
Assert.AreEqual(2, changesPage2.Page);
|
||||
Assert.IsNotNull(changesPage2);
|
||||
Assert.AreEqual(2, changesPage2.Page);
|
||||
|
||||
// Check date range (max)
|
||||
DateTime higher = DateTime.UtcNow.AddDays(-7);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = _config.Client.GetChangesMovies(endDate: higher);
|
||||
// Check date range (max)
|
||||
DateTime higher = DateTime.UtcNow.AddDays(-7);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = _config.Client.GetChangesMovies(endDate: higher);
|
||||
|
||||
Assert.IsNotNull(changesMaxDate);
|
||||
Assert.AreEqual(1, changesMaxDate.Page);
|
||||
Assert.AreNotEqual(changesPage1.TotalResults, changesMaxDate.TotalResults);
|
||||
Assert.IsNotNull(changesMaxDate);
|
||||
Assert.AreEqual(1, changesMaxDate.Page);
|
||||
Assert.AreNotEqual(changesPage1.TotalResults, changesMaxDate.TotalResults);
|
||||
|
||||
// Check date range (lower)
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-6); // Use 6 days to avoid clashes with the 'higher'
|
||||
SearchContainer<ChangesListItem> changesLowDate = _config.Client.GetChangesMovies(startDate: lower);
|
||||
// Check date range (lower)
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-6); // Use 6 days to avoid clashes with the 'higher'
|
||||
SearchContainer<ChangesListItem> changesLowDate = _config.Client.GetChangesMovies(startDate: lower);
|
||||
|
||||
Assert.IsNotNull(changesLowDate);
|
||||
Assert.AreEqual(1, changesLowDate.Page);
|
||||
Assert.AreNotEqual(changesPage1.TotalResults, changesLowDate.TotalResults);
|
||||
}
|
||||
Assert.IsNotNull(changesLowDate);
|
||||
Assert.AreEqual(1, changesLowDate.Page);
|
||||
Assert.AreNotEqual(changesPage1.TotalResults, changesLowDate.TotalResults);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestChangesPeople()
|
||||
{
|
||||
// Basic check
|
||||
SearchContainer<ChangesListItem> changesPage1 = _config.Client.GetChangesPeople();
|
||||
[TestMethod]
|
||||
public void TestChangesPeople()
|
||||
{
|
||||
// Basic check
|
||||
SearchContainer<ChangesListItem> changesPage1 = _config.Client.GetChangesPeople();
|
||||
|
||||
Assert.IsNotNull(changesPage1);
|
||||
Assert.IsTrue(changesPage1.Results.Count > 0);
|
||||
Assert.IsTrue(changesPage1.TotalResults > changesPage1.Results.Count);
|
||||
Assert.AreEqual(1, changesPage1.Page);
|
||||
Assert.IsNotNull(changesPage1);
|
||||
Assert.IsTrue(changesPage1.Results.Count > 0);
|
||||
Assert.IsTrue(changesPage1.TotalResults > changesPage1.Results.Count);
|
||||
Assert.AreEqual(1, changesPage1.Page);
|
||||
|
||||
// Page 2
|
||||
SearchContainer<ChangesListItem> changesPage2 = _config.Client.GetChangesPeople(2);
|
||||
// Page 2
|
||||
SearchContainer<ChangesListItem> changesPage2 = _config.Client.GetChangesPeople(2);
|
||||
|
||||
Assert.IsNotNull(changesPage2);
|
||||
Assert.AreEqual(2, changesPage2.Page);
|
||||
Assert.IsNotNull(changesPage2);
|
||||
Assert.AreEqual(2, changesPage2.Page);
|
||||
|
||||
// Check date range (max)
|
||||
DateTime higher = DateTime.UtcNow.AddDays(-7);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = _config.Client.GetChangesPeople(endDate: higher);
|
||||
// Check date range (max)
|
||||
DateTime higher = DateTime.UtcNow.AddDays(-7);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = _config.Client.GetChangesPeople(endDate: higher);
|
||||
|
||||
Assert.IsNotNull(changesMaxDate);
|
||||
Assert.AreEqual(1, changesMaxDate.Page);
|
||||
Assert.AreNotEqual(changesPage1.TotalResults, changesMaxDate.TotalResults);
|
||||
Assert.IsNotNull(changesMaxDate);
|
||||
Assert.AreEqual(1, changesMaxDate.Page);
|
||||
Assert.AreNotEqual(changesPage1.TotalResults, changesMaxDate.TotalResults);
|
||||
|
||||
// Check date range (lower)
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-6); // Use 6 days to avoid clashes with the 'higher'
|
||||
SearchContainer<ChangesListItem> changesLowDate = _config.Client.GetChangesPeople(startDate: lower);
|
||||
// Check date range (lower)
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-6); // Use 6 days to avoid clashes with the 'higher'
|
||||
SearchContainer<ChangesListItem> changesLowDate = _config.Client.GetChangesPeople(startDate: lower);
|
||||
|
||||
Assert.IsNotNull(changesLowDate);
|
||||
Assert.AreEqual(1, changesLowDate.Page);
|
||||
Assert.AreNotEqual(changesPage1.TotalResults, changesLowDate.TotalResults);
|
||||
Assert.IsNotNull(changesLowDate);
|
||||
Assert.AreEqual(1, changesLowDate.Page);
|
||||
Assert.AreNotEqual(changesPage1.TotalResults, changesLowDate.TotalResults);
|
||||
|
||||
// None of the id's in changesLowDate should exist in changesMaxDate, and vice versa
|
||||
Assert.IsTrue(changesLowDate.Results.All(lowItem => changesMaxDate.Results.All(maxItem => maxItem.Id != lowItem.Id)));
|
||||
Assert.IsTrue(changesMaxDate.Results.All(maxItem => changesLowDate.Results.All(lowItem => maxItem.Id != lowItem.Id)));
|
||||
}
|
||||
// None of the id's in changesLowDate should exist in changesMaxDate, and vice versa
|
||||
Assert.IsTrue(changesLowDate.Results.All(lowItem => changesMaxDate.Results.All(maxItem => maxItem.Id != lowItem.Id)));
|
||||
Assert.IsTrue(changesMaxDate.Results.All(maxItem => changesLowDate.Results.All(lowItem => maxItem.Id != lowItem.Id)));
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void TestChangesTvShows()
|
||||
{
|
||||
// Basic check
|
||||
SearchContainer<ChangesListItem> changesPage1 = _config.Client.GetChangesTv();
|
||||
[TestMethod]
|
||||
public void TestChangesTvShows()
|
||||
{
|
||||
// Basic check
|
||||
SearchContainer<ChangesListItem> changesPage1 = _config.Client.GetChangesTv();
|
||||
|
||||
Assert.IsNotNull(changesPage1);
|
||||
Assert.IsNotNull(changesPage1.Results);
|
||||
Assert.IsTrue(changesPage1.Results.Count > 0);
|
||||
Assert.IsTrue(changesPage1.TotalResults >= changesPage1.Results.Count);
|
||||
Assert.AreEqual(1, changesPage1.Page);
|
||||
Assert.IsNotNull(changesPage1);
|
||||
Assert.IsNotNull(changesPage1.Results);
|
||||
Assert.IsTrue(changesPage1.Results.Count > 0);
|
||||
Assert.IsTrue(changesPage1.TotalResults >= changesPage1.Results.Count);
|
||||
Assert.AreEqual(1, changesPage1.Page);
|
||||
|
||||
if (changesPage1.TotalPages > 1)
|
||||
{
|
||||
Assert.IsTrue(changesPage1.TotalResults > changesPage1.Results.Count);
|
||||
// Page 2
|
||||
SearchContainer<ChangesListItem> changesPage2 = _config.Client.GetChangesTv(2);
|
||||
if (changesPage1.TotalPages > 1)
|
||||
{
|
||||
Assert.IsTrue(changesPage1.TotalResults > changesPage1.Results.Count);
|
||||
// Page 2
|
||||
SearchContainer<ChangesListItem> changesPage2 = _config.Client.GetChangesTv(2);
|
||||
|
||||
Assert.IsNotNull(changesPage2);
|
||||
Assert.AreEqual(2, changesPage2.Page);
|
||||
}
|
||||
Assert.IsNotNull(changesPage2);
|
||||
Assert.AreEqual(2, changesPage2.Page);
|
||||
}
|
||||
|
||||
// Check date range (max)
|
||||
DateTime higher = DateTime.UtcNow.AddDays(-7);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = _config.Client.GetChangesTv(endDate: higher);
|
||||
// Check date range (max)
|
||||
DateTime higher = DateTime.UtcNow.AddDays(-8);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = _config.Client.GetChangesTv(endDate: higher);
|
||||
|
||||
Assert.IsNotNull(changesMaxDate);
|
||||
Assert.AreEqual(1, changesMaxDate.Page);
|
||||
Assert.AreNotEqual(changesPage1.TotalResults, changesMaxDate.TotalResults);
|
||||
Assert.IsNotNull(changesMaxDate);
|
||||
Assert.AreEqual(1, changesMaxDate.Page);
|
||||
Assert.AreNotEqual(changesPage1.TotalResults, changesMaxDate.TotalResults);
|
||||
|
||||
// Check date range (lower)
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-6); // Use 6 days to avoid clashes with the 'higher'
|
||||
SearchContainer<ChangesListItem> changesLowDate = _config.Client.GetChangesTv(startDate: lower);
|
||||
// Check date range (lower)
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-6); // Use 6 days to avoid clashes with the 'higher'
|
||||
SearchContainer<ChangesListItem> changesLowDate = _config.Client.GetChangesTv(startDate: lower);
|
||||
|
||||
Assert.IsNotNull(changesLowDate);
|
||||
Assert.AreEqual(1, changesLowDate.Page);
|
||||
Assert.AreNotEqual(changesPage1.TotalResults, changesLowDate.TotalResults);
|
||||
Assert.IsNotNull(changesLowDate);
|
||||
Assert.AreEqual(1, changesLowDate.Page);
|
||||
Assert.AreNotEqual(changesPage1.TotalResults, changesLowDate.TotalResults);
|
||||
|
||||
// None of the id's in changesLowDate should exist in changesMaxDate, and vice versa
|
||||
Assert.IsTrue(changesLowDate.Results.All(lowItem => changesMaxDate.Results.All(maxItem => maxItem.Id != lowItem.Id)));
|
||||
Assert.IsTrue(changesMaxDate.Results.All(maxItem => changesLowDate.Results.All(lowItem => maxItem.Id != lowItem.Id)));
|
||||
}
|
||||
}
|
||||
// None of the id's in changesLowDate should exist in changesMaxDate, and vice versa
|
||||
foreach (ChangesListItem changeItem in changesLowDate.Results)
|
||||
{
|
||||
bool existsInOtherList = changesMaxDate.Results.Any(x => x.Id == changeItem.Id);
|
||||
|
||||
Assert.IsFalse(existsInOtherList, "Item id " + changeItem.Id + " is duplicated");
|
||||
}
|
||||
|
||||
foreach (ChangesListItem changeItem in changesMaxDate.Results)
|
||||
{
|
||||
bool existsInOtherList = changesLowDate.Results.Any(x => x.Id == changeItem.Id);
|
||||
|
||||
Assert.IsFalse(existsInOtherList, "Item id " + changeItem.Id + " is duplicated");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ namespace TMDbLibTests
|
||||
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
|
||||
MovieAccountState accountState = _config.Client.GetMovieAccountState(AGoodDayToDieHard);
|
||||
|
||||
// For this test to pass the movie A Good Day To Die Hard need to be NOT rated, and REMOVED to the favorite list and watchlist
|
||||
// For this test to pass the movie A Good Day To Die Hard need to be NOT rated, and REMOVED from the favorite list and watchlist
|
||||
Assert.AreEqual(AGoodDayToDieHard, accountState.Id);
|
||||
Assert.IsNull(accountState.Rating);
|
||||
Assert.IsFalse(accountState.Favorite, "Please remove A Good Day To Die Hard from the users favourites list");
|
||||
|
Loading…
Reference in New Issue
Block a user