// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp.Tests { using System.IO; using System.Reflection; using ImageSharp.Formats; /// /// The test base class. Inherit from this class for any image manipulation tests. /// public abstract class TestBase { /// /// Creates the image output directory. /// /// The path. /// The path parts. /// /// The . /// protected string CreateOutputDirectory(string path, params string[] pathParts) { string assemblyLocation = typeof(TestFile).GetTypeInfo().Assembly.Location; assemblyLocation = Path.GetDirectoryName(assemblyLocation); path = Path.GetFullPath(Path.Combine(assemblyLocation, "../../../TestOutput", path)); if (pathParts != null && pathParts.Length > 0) { path = Path.Combine(path, Path.Combine(pathParts)); } if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } return path; } } }