diff --git a/ImageSharp.sln b/ImageSharp.sln
index 1f848b34d..f1e9fb104 100644
--- a/ImageSharp.sln
+++ b/ImageSharp.sln
@@ -53,6 +53,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{9E574A
src\Shared\stylecop.json = src\Shared\stylecop.json
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageSharp.Sandbox46", "tests\ImageSharp.Sandbox46\ImageSharp.Sandbox46.csproj", "{96188137-5FA6-4924-AB6E-4EFF79C6E0BB}"
+ ProjectSection(ProjectDependencies) = postProject
+ {299D8E18-102C-42DE-ADBF-79098EE706A8} = {299D8E18-102C-42DE-ADBF-79098EE706A8}
+ {2E33181E-6E28-4662-A801-E2E7DC206029} = {2E33181E-6E28-4662-A801-E2E7DC206029}
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26} = {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}
+ {27AD4B5F-ECC4-4C63-9ECB-04EC772FDB6F} = {27AD4B5F-ECC4-4C63-9ECB-04EC772FDB6F}
+ {7213767C-0003-41CA-AB18-0223CFA7CE4B} = {7213767C-0003-41CA-AB18-0223CFA7CE4B}
+ {C77661B9-F793-422E-8E27-AC60ECC5F215} = {C77661B9-F793-422E-8E27-AC60ECC5F215}
+ {556ABDCF-ED93-4327-BE98-F6815F78B9B8} = {556ABDCF-ED93-4327-BE98-F6815F78B9B8}
+ {A623CFE9-9D2B-4528-AD1F-2E834B061134} = {A623CFE9-9D2B-4528-AD1F-2E834B061134}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -99,6 +111,10 @@ Global
{A623CFE9-9D2B-4528-AD1F-2E834B061134}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A623CFE9-9D2B-4528-AD1F-2E834B061134}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A623CFE9-9D2B-4528-AD1F-2E834B061134}.Release|Any CPU.Build.0 = Release|Any CPU
+ {96188137-5FA6-4924-AB6E-4EFF79C6E0BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {96188137-5FA6-4924-AB6E-4EFF79C6E0BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {96188137-5FA6-4924-AB6E-4EFF79C6E0BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {96188137-5FA6-4924-AB6E-4EFF79C6E0BB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -115,5 +131,6 @@ Global
{556ABDCF-ED93-4327-BE98-F6815F78B9B8} = {815C0625-CD3D-440F-9F80-2D83856AB7AE}
{A623CFE9-9D2B-4528-AD1F-2E834B061134} = {815C0625-CD3D-440F-9F80-2D83856AB7AE}
{9E574A07-F879-4811-9C41-5CBDC6BAFDB7} = {815C0625-CD3D-440F-9F80-2D83856AB7AE}
+ {96188137-5FA6-4924-AB6E-4EFF79C6E0BB} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
EndGlobalSection
EndGlobal
diff --git a/src/Shared/AssemblyInfo.Common.cs b/src/Shared/AssemblyInfo.Common.cs
index 09f2d0d02..11f16769b 100644
--- a/src/Shared/AssemblyInfo.Common.cs
+++ b/src/Shared/AssemblyInfo.Common.cs
@@ -35,4 +35,5 @@ using System.Runtime.CompilerServices;
// Ensure the internals can be tested.
[assembly: InternalsVisibleTo("ImageSharp.Benchmarks")]
-[assembly: InternalsVisibleTo("ImageSharp.Tests")]
\ No newline at end of file
+[assembly: InternalsVisibleTo("ImageSharp.Tests")]
+[assembly: InternalsVisibleTo("ImageSharp.Sandbox46")]
\ No newline at end of file
diff --git a/tests/ImageSharp.Sandbox46/ImageSharp.Sandbox46.csproj b/tests/ImageSharp.Sandbox46/ImageSharp.Sandbox46.csproj
new file mode 100644
index 000000000..19ff65f1d
--- /dev/null
+++ b/tests/ImageSharp.Sandbox46/ImageSharp.Sandbox46.csproj
@@ -0,0 +1,217 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {96188137-5FA6-4924-AB6E-4EFF79C6E0BB}
+ Library
+ Properties
+ ImageSharp
+ ImageSharp.Sandbox46
+ v4.6.1
+ 512
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ true
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE;BENCHMARKING
+ prompt
+ 4
+ true
+
+
+
+
+
+
+ ..\..\packages\System.Numerics.Vectors.4.1.1\lib\net46\System.Numerics.Vectors.dll
+ True
+
+
+
+
+
+
+
+
+ ..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll
+ True
+
+
+ ..\..\packages\xunit.assert.2.2.0-beta4-build3444\lib\netstandard1.0\xunit.assert.dll
+ True
+
+
+ ..\..\packages\xunit.extensibility.core.2.2.0-beta4-build3444\lib\net45\xunit.core.dll
+ True
+
+
+ ..\..\packages\xunit.extensibility.execution.2.2.0-beta4-build3444\lib\net45\xunit.execution.desktop.dll
+ True
+
+
+
+
+ ..\..\src\ImageSharp\bin\$(Configuration)\net45\ImageSharp.dll
+
+
+ ..\..\src\ImageSharp.Drawing\bin\$(Configuration)\net45\ImageSharp.Drawing.dll
+
+
+ ..\..\src\ImageSharp.Formats.Bmp\bin\$(Configuration)\net45\ImageSharp.Formats.Bmp.dll
+
+
+ ..\..\src\ImageSharp.Formats.Gif\bin\$(Configuration)\net45\ImageSharp.Formats.Gif.dll
+
+
+ ..\..\src\ImageSharp.Formats.Jpeg\bin\$(Configuration)\net45\ImageSharp.Formats.Jpeg.dll
+
+
+ ..\..\src\ImageSharp.Formats.Png\bin\$(Configuration)\net45\ImageSharp.Formats.Png.dll
+
+
+ ..\..\src\ImageSharp.Processing\bin\$(Configuration)\net45\ImageSharp.Processing.dll
+
+
+
+
+ Tests\Drawing\PolygonTests.cs
+
+
+ Tests\FileTestBase.cs
+
+
+ Tests\Formats\Jpg\Block8x8FTests.cs
+
+
+ Tests\Formats\Jpg\JpegTestBase.cs
+
+
+ Tests\Formats\Jpg\JpegTests.cs
+
+
+ Tests\Formats\Jpg\ReferenceImplementations.cs
+
+
+ Tests\Formats\Jpg\ReferenceImplementationsTests.cs
+
+
+ Tests\Formats\Jpg\YCbCrImageTests.cs
+
+
+ Tests\Image\ImagePropertyTests.cs
+
+
+ Tests\Image\ImageTests.cs
+
+
+ Tests\Image\PixelAccessorTests.cs
+
+
+ Tests\Processors\Filters\ResizeTests.cs
+
+
+ Tests\TestBase.cs
+
+
+ Tests\TestFile.cs
+
+
+ Tests\TestImages.cs
+
+
+ Tests\TestUtilities\Attributes\ImageDataAttributeBase.cs
+
+
+ Tests\TestUtilities\Attributes\WithBlankImageAttribute.cs
+
+
+ Tests\TestUtilities\Attributes\WithFileAttribute.cs
+
+
+ Tests\TestUtilities\Attributes\WithFileCollectionAttribute.cs
+
+
+ Tests\TestUtilities\Attributes\WithMemberFactoryAttribute.cs
+
+
+ Tests\TestUtilities\Attributes\WithSolidFilledImagesAttribute.cs
+
+
+ Tests\TestUtilities\Factories\GenericFactory.cs
+
+
+ Tests\TestUtilities\Factories\ImageFactory.cs
+
+
+ Tests\TestUtilities\ImageProviders\BlankProvider.cs
+
+
+ Tests\TestUtilities\ImageProviders\FileProvider.cs
+
+
+ Tests\TestUtilities\ImageProviders\LambdaProvider.cs
+
+
+ Tests\TestUtilities\ImageProviders\SolidProvider.cs
+
+
+ Tests\TestUtilities\ImageProviders\TestImageProvider.cs
+
+
+ Tests\TestUtilities\ImagingTestCaseUtility.cs
+
+
+ Tests\TestUtilities\MeasureFixture.cs
+
+
+ Tests\TestUtilities\PixelTypes.cs
+
+
+ Tests\TestUtilities\Tests\TestImageProviderTests.cs
+
+
+ Tests\TestUtilities\Tests\TestUtilityExtensionsTests.cs
+
+
+ Tests\TestUtilities\TestUtilityExtensions.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/ImageSharp.Sandbox46/Properties/AssemblyInfo.cs b/tests/ImageSharp.Sandbox46/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..51b205188
--- /dev/null
+++ b/tests/ImageSharp.Sandbox46/Properties/AssemblyInfo.cs
@@ -0,0 +1,25 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+
+[assembly: AssemblyTitle("ImageSharp.Sandbox46")]
+[assembly: AssemblyDescription("A cross-platform library for processing of image files written in C#")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ImageSharp.Sandbox46")]
+[assembly: AssemblyCopyright("Copyright © James Jackson-South and contributors.")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("96188137-5fa6-4924-ab6e-4eff79c6e0bb")]
diff --git a/tests/ImageSharp.Sandbox46/README.md b/tests/ImageSharp.Sandbox46/README.md
new file mode 100644
index 000000000..b05afb853
--- /dev/null
+++ b/tests/ImageSharp.Sandbox46/README.md
@@ -0,0 +1,24 @@
+## Purpose
+This project aims to workaround certain .NET Core tooling issues in Visual Studio based developer workflow at the time of it's creation (January 2017):
+- .NET Core Performance profiling is not possible neither with Visual Studio nor with JetBrains profilers
+- ~~JetBrains Unit Test explorer does not work with .NET Core projects~~
+
+## How does it work?
+- By referencing .NET 4.5 dll-s created by net45 target's of ImageSharp projects. NOTE: These are not project references!
+- By including test classes (and utility classes) of the `ImageSharp.Tests` project using MSBUILD ``
+- Compiling `ImageSharp.Sandbox46` should trigger the compilation of ImageSharp subprojects using a manually defined solution dependencies
+
+## How to profile unit tests
+
+#### 1. With Visual Studio 2015 Test Runner
+- **Do not** build `ImageSharp.Tests`
+- Build `ImageSharp.Sandbox46`
+- Use the [context menu in Test Explorer](https://adamprescott.net/2012/12/12/performance-profiling-for-unit-tests/)
+
+NOTE:
+There was no *Profile test* option in my VS Professional. Maybe things were messed by VS2017 RC installation. [This post suggests](http://stackoverflow.com/questions/32034375/profiling-tests-in-visual-studio-community-2015) it's necessary to own Premium or Ultimate edition of Visual Studio to profile tests.
+
+#### 2. With JetBrains ReSharper Ultimate
+- The `Sandbox46` project is no longer needed here. The classic `ImageSharp.Tests` project can be discovered by Unit Test Explorer.
+- You can use [context menus](https://www.jetbrains.com/resharper/features/unit_testing.html) from your test class, or from unit Test Exporer/Unit Test Sessions windows.
+
\ No newline at end of file
diff --git a/tests/ImageSharp.Sandbox46/packages.config b/tests/ImageSharp.Sandbox46/packages.config
new file mode 100644
index 000000000..8163e6e2e
--- /dev/null
+++ b/tests/ImageSharp.Sandbox46/packages.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/TestFile.cs b/tests/ImageSharp.Tests/TestFile.cs
index 61a6a9f64..3d6695841 100644
--- a/tests/ImageSharp.Tests/TestFile.cs
+++ b/tests/ImageSharp.Tests/TestFile.cs
@@ -5,11 +5,12 @@
namespace ImageSharp.Tests
{
+ using System;
using System.Collections.Concurrent;
+ using System.Collections.Generic;
using System.IO;
-
- using ImageSharp.Formats;
using System.Linq;
+ using System.Reflection;
///
/// A test image file.
@@ -35,7 +36,7 @@ namespace ImageSharp.Tests
/// The file.
///
private readonly string file;
-
+
///
/// Initializes a new instance of the class.
///
@@ -132,13 +133,19 @@ namespace ImageSharp.Tests
///
private static string GetFormatsDirectory()
{
- var directories = new[] {
+ List directories = new List< string > {
"TestImages/Formats/", // Here for code coverage tests.
"tests/ImageSharp.Tests/TestImages/Formats/", // from travis/build script
- "../../../../TestImages/Formats/"
+ "../../../ImageSharp.Tests/TestImages/Formats/", // from Sandbox46
+ "../../../../TestImages/Formats/"
};
- directories= directories.Select(x => Path.GetFullPath(x)).ToArray();
+ directories = directories.SelectMany(x => new[]
+ {
+ Path.GetFullPath(x)
+ }).ToList();
+
+ AddFormatsDirectoryFromTestAssebmlyPath(directories);
var directory = directories.FirstOrDefault(x => Directory.Exists(x));
@@ -149,5 +156,24 @@ namespace ImageSharp.Tests
throw new System.Exception($"Unable to find Formats directory at any of these locations [{string.Join(", ", directories)}]");
}
+
+ ///
+ /// The path returned by Path.GetFullPath(x) can be relative to dotnet framework directory
+ /// in certain scenarios like dotTrace test profiling.
+ /// This method calculates and adds the format directory based on the ImageSharp.Tests assembly location.
+ ///
+ /// The directories list
+ private static void AddFormatsDirectoryFromTestAssebmlyPath(List directories)
+ {
+ string assemblyLocation = typeof(TestFile).GetTypeInfo().Assembly.Location;
+ assemblyLocation = Path.GetDirectoryName(assemblyLocation);
+
+ if (assemblyLocation != null)
+ {
+ string dirFromAssemblyLocation = Path.Combine(assemblyLocation, "../../../TestImages/Formats/");
+ dirFromAssemblyLocation = Path.GetFullPath(dirFromAssemblyLocation);
+ directories.Add(dirFromAssemblyLocation);
+ }
+ }
}
}