- Fixed up some tests

- Reduced test amount for images, now checks only 1 size pr. image
This commit is contained in:
Michael Bisbjerg 2013-02-17 23:10:28 +01:00
parent a1113d1bfa
commit 4474493645
2 changed files with 13 additions and 27 deletions

View File

@ -204,8 +204,8 @@ namespace TMDbLibTests
int latestChanged = _config.Client.GetMovieLatest().Id;
// Fetch changelog
DateTime lower = DateTime.UtcNow.AddDays(-14);
DateTime higher = DateTime.UtcNow;
DateTime lower = DateTime.UtcNow.AddDays(-13);
DateTime higher = DateTime.UtcNow.AddDays(1);
List<Change> respRange = _config.Client.GetMovieChanges(latestChanged, lower, higher);
Assert.IsNotNull(respRange);

View File

@ -1,8 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using TMDbLib.Objects.General;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
namespace TMDbLibTests.Helpers
{
@ -13,38 +12,25 @@ namespace TMDbLibTests.Helpers
Assert.IsTrue(images.Backdrops.Count > 0);
Assert.IsTrue(images.Posters.Count > 0);
Debug.WriteLine("Found {0} backdrops, {1} posters.", images.Backdrops.Count, images.Posters.Count);
List<string> backdropSizes = config.Client.Config.Images.BackdropSizes;
List<string> posterSizes = config.Client.Config.Images.PosterSizes;
Debug.WriteLine("Found {0} backdrop sizes, {1} poster sizes.", backdropSizes.Count, posterSizes.Count);
Debug.WriteLine("Total: {0} backdrops", images.Backdrops.Count * backdropSizes.Count);
string backdropSizes = config.Client.Config.Images.BackdropSizes.First();
string posterSizes = config.Client.Config.Images.PosterSizes.First();
foreach (ImageData imageData in images.Backdrops)
{
foreach (string size in backdropSizes)
{
Uri url = config.Client.GetImageUrl(size, imageData.FilePath);
Uri urlSecure = config.Client.GetImageUrl(size, imageData.FilePath, true);
Uri url = config.Client.GetImageUrl(backdropSizes, imageData.FilePath);
Uri urlSecure = config.Client.GetImageUrl(backdropSizes, imageData.FilePath, true);
Assert.IsTrue(TestHelpers.InternetUriExists(url));
Assert.IsTrue(TestHelpers.InternetUriExists(urlSecure));
}
Assert.IsTrue(TestHelpers.InternetUriExists(url));
Assert.IsTrue(TestHelpers.InternetUriExists(urlSecure));
}
Debug.WriteLine("Total: {0} posters", images.Posters.Count * posterSizes.Count);
foreach (ImageData imageData in images.Posters)
{
foreach (string size in posterSizes)
{
Uri url = config.Client.GetImageUrl(size, imageData.FilePath);
Uri urlSecure = config.Client.GetImageUrl(size, imageData.FilePath, true);
Uri url = config.Client.GetImageUrl(posterSizes, imageData.FilePath);
Uri urlSecure = config.Client.GetImageUrl(posterSizes, imageData.FilePath, true);
Assert.IsTrue(TestHelpers.InternetUriExists(url));
Assert.IsTrue(TestHelpers.InternetUriExists(urlSecure));
}
Assert.IsTrue(TestHelpers.InternetUriExists(url));
Assert.IsTrue(TestHelpers.InternetUriExists(urlSecure));
}
}
}