From 4474493645bef744339ddcc826646b311b9f70b7 Mon Sep 17 00:00:00 2001 From: Michael Bisbjerg Date: Sun, 17 Feb 2013 23:10:28 +0100 Subject: [PATCH] - Fixed up some tests - Reduced test amount for images, now checks only 1 size pr. image --- TMDbLibTests/ClientMovieTests.cs | 4 +-- TMDbLibTests/Helpers/TestImagesHelpers.cs | 36 +++++++---------------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/TMDbLibTests/ClientMovieTests.cs b/TMDbLibTests/ClientMovieTests.cs index c631727..04afa77 100644 --- a/TMDbLibTests/ClientMovieTests.cs +++ b/TMDbLibTests/ClientMovieTests.cs @@ -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 respRange = _config.Client.GetMovieChanges(latestChanged, lower, higher); Assert.IsNotNull(respRange); diff --git a/TMDbLibTests/Helpers/TestImagesHelpers.cs b/TMDbLibTests/Helpers/TestImagesHelpers.cs index a89b066..ec42c53 100644 --- a/TMDbLibTests/Helpers/TestImagesHelpers.cs +++ b/TMDbLibTests/Helpers/TestImagesHelpers.cs @@ -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 backdropSizes = config.Client.Config.Images.BackdropSizes; - List 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)); } } }