From 08ddcd9b0ff1e48a6c25734c1a34360310fed151 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Sun, 1 Jan 2017 16:01:36 +0000 Subject: [PATCH] run tests on travis --- .travis.yml | 1 + tests/ImageSharp.Tests/TestFile.cs | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6a6f2e166..7e4273d73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ branches: script: - dotnet restore - dotnet build -c Release src/*/project.json + - dotnet test tests\ImageSharp.Tests\project.json -c Release -f "netcoreapp1.1" env: global: diff --git a/tests/ImageSharp.Tests/TestFile.cs b/tests/ImageSharp.Tests/TestFile.cs index 566796bf8..2618549f1 100644 --- a/tests/ImageSharp.Tests/TestFile.cs +++ b/tests/ImageSharp.Tests/TestFile.cs @@ -9,6 +9,7 @@ namespace ImageSharp.Tests using System.IO; using ImageSharp.Formats; + using System.Linq; /// /// A test image file. @@ -144,14 +145,22 @@ namespace ImageSharp.Tests /// private static string GetFormatsDirectory() { - // Here for code coverage tests. - string directory = "TestImages/Formats/"; - if (Directory.Exists(directory)) + var directories = new[] { + "TestImages/Formats/", // Here for code coverage tests. + "tests/ImageSharp.Tests/TestImages/Formats/", // from travis/build script + "../../../../TestImages/Formats/" + }; + + directories= directories.Select(x => Path.GetFullPath(x)).ToArray(); + + var directory = directories.FirstOrDefault(x => Directory.Exists(x)); + + if(directory != null) { return directory; } - return "../../../../TestImages/Formats/"; + throw new System.Exception($"Unable to find Formats directory at any of these locations [{string.Join(", ", directories)}]"); } } }