Browse Source

Refactored creating the output directory.

Former-commit-id: f23cc3264514e4c882d0a2ed41ffc23f9abb54ef
Former-commit-id: b9e32392f090e1fd3f0c534bad3939360d0dcecd
Former-commit-id: 6276382a7659cc1f3fed381c2cedcee611947da5
pull/1/head
dirk 9 years ago
parent
commit
c6f775877d
  1. 13
      tests/ImageProcessorCore.Tests/FileTestBase.cs
  2. 6
      tests/ImageProcessorCore.Tests/Formats/Bmp/BitmapTests.cs
  3. 36
      tests/ImageProcessorCore.Tests/Formats/GeneralFormatTests.cs
  4. 6
      tests/ImageProcessorCore.Tests/Formats/Png/PngTests.cs
  5. 12
      tests/ImageProcessorCore.Tests/Processors/Filters/AlphaTest.cs
  6. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/BackgroundColorTest.cs
  7. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/BinaryThreshold.cs
  8. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/BlackWhiteTest.cs
  9. 8
      tests/ImageProcessorCore.Tests/Processors/Filters/BlendTest.cs
  10. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/BoxBlurTest.cs
  11. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/BrightnessTest.cs
  12. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/ColorBlindnessTest.cs
  13. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/ContrastTest.cs
  14. 24
      tests/ImageProcessorCore.Tests/Processors/Filters/GlowTest.cs
  15. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/GrayscaleTest.cs
  16. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/HueTest.cs
  17. 13
      tests/ImageProcessorCore.Tests/Processors/Filters/InvertTest.cs
  18. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/KodachromeTest.cs
  19. 13
      tests/ImageProcessorCore.Tests/Processors/Filters/LomographTest.cs
  20. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/PolaroidTest.cs
  21. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/SaturationTest.cs
  22. 6
      tests/ImageProcessorCore.Tests/Processors/Filters/SepiaTest.cs
  23. 24
      tests/ImageProcessorCore.Tests/Processors/Filters/VignetteTest.cs
  24. 6
      tests/ImageProcessorCore.Tests/Processors/Samplers/AutoOrientTests.cs
  25. 6
      tests/ImageProcessorCore.Tests/Processors/Samplers/CropTest.cs
  26. 12
      tests/ImageProcessorCore.Tests/Processors/Samplers/DetectEdgesTest.cs
  27. 6
      tests/ImageProcessorCore.Tests/Processors/Samplers/EntropyCropTest.cs
  28. 6
      tests/ImageProcessorCore.Tests/Processors/Samplers/FlipTests.cs
  29. 6
      tests/ImageProcessorCore.Tests/Processors/Samplers/GuassianBlurTest.cs
  30. 6
      tests/ImageProcessorCore.Tests/Processors/Samplers/GuassianSharpenTest.cs
  31. 12
      tests/ImageProcessorCore.Tests/Processors/Samplers/OilPaintTest.cs
  32. 6
      tests/ImageProcessorCore.Tests/Processors/Samplers/PadTest.cs
  33. 12
      tests/ImageProcessorCore.Tests/Processors/Samplers/PixelateTest.cs
  34. 52
      tests/ImageProcessorCore.Tests/Processors/Samplers/ResizeTests.cs
  35. 6
      tests/ImageProcessorCore.Tests/Processors/Samplers/RotateFlipTest.cs
  36. 12
      tests/ImageProcessorCore.Tests/Processors/Samplers/RotateTest.cs
  37. 6
      tests/ImageProcessorCore.Tests/Processors/Samplers/SkewTest.cs

13
tests/ImageProcessorCore.Tests/FileTestBase.cs

@ -5,6 +5,7 @@
namespace ImageProcessorCore.Tests namespace ImageProcessorCore.Tests
{ {
using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
/// <summary> /// <summary>
@ -34,5 +35,17 @@ namespace ImageProcessorCore.Tests
new TestFile(TestImages.Gif.Rings), new TestFile(TestImages.Gif.Rings),
//new TestFile(TestImages.Gif.Giphy) // Perf: Enable for local testing only //new TestFile(TestImages.Gif.Giphy) // Perf: Enable for local testing only
}; };
protected string CreateOutputDirectory(string path)
{
path = "TestOutput/" + path;
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
return path;
}
} }
} }

6
tests/ImageProcessorCore.Tests/Formats/Bmp/BitmapTests.cs

@ -24,11 +24,7 @@ namespace ImageProcessorCore.Tests
[MemberData("BitsPerPixel")] [MemberData("BitsPerPixel")]
public void BitmapCanEncodeDifferentBitRates(BmpBitsPerPixel bitsPerPixel) public void BitmapCanEncodeDifferentBitRates(BmpBitsPerPixel bitsPerPixel)
{ {
const string path = "TestOutput/Bmp"; string path = CreateOutputDirectory("Bmp");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

36
tests/ImageProcessorCore.Tests/Formats/GeneralFormatTests.cs

@ -15,11 +15,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ResolutionShouldChange() public void ResolutionShouldChange()
{ {
const string path = "TestOutput/Resolution"; string path = CreateOutputDirectory("Resolution");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -37,11 +33,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageCanEncodeToString() public void ImageCanEncodeToString()
{ {
const string path = "TestOutput/ToString"; string path = CreateOutputDirectory("ToString");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -55,11 +47,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void DecodeThenEncodeImageFromStreamShouldSucceed() public void DecodeThenEncodeImageFromStreamShouldSucceed()
{ {
const string path = "TestOutput/Encode"; string path = CreateOutputDirectory("Encode");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -75,11 +63,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void QuantizeImageShouldPreserveMaximumColorPrecision() public void QuantizeImageShouldPreserveMaximumColorPrecision()
{ {
const string path = "TestOutput/Quantize"; string path = CreateOutputDirectory("Quantize");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -115,11 +99,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageCanConvertFormat() public void ImageCanConvertFormat()
{ {
const string path = "TestOutput/Format"; string path = CreateOutputDirectory("Format");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -150,11 +130,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldPreservePixelByteOrderWhenSerialized() public void ImageShouldPreservePixelByteOrderWhenSerialized()
{ {
const string path = "TestOutput/Serialized"; string path = CreateOutputDirectory("Serialized");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Formats/Png/PngTests.cs

@ -16,11 +16,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageCanSaveIndexedPng() public void ImageCanSaveIndexedPng()
{ {
const string path = "TestOutput/Png"; string path = CreateOutputDirectory("Png");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

12
tests/ImageProcessorCore.Tests/Processors/Filters/AlphaTest.cs

@ -22,11 +22,7 @@ namespace ImageProcessorCore.Tests
[MemberData("AlphaValues")] [MemberData("AlphaValues")]
public void ImageShouldApplyAlphaFilter(int value) public void ImageShouldApplyAlphaFilter(int value)
{ {
const string path = "TestOutput/Alpha"; string path = CreateOutputDirectory("Alpha");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -45,11 +41,7 @@ namespace ImageProcessorCore.Tests
[MemberData("AlphaValues")] [MemberData("AlphaValues")]
public void ImageShouldApplyAlphaFilterInBox(int value) public void ImageShouldApplyAlphaFilterInBox(int value)
{ {
const string path = "TestOutput/Alpha"; string path = CreateOutputDirectory("Alpha");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Filters/BackgroundColorTest.cs

@ -14,11 +14,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyBackgroundColorFilter() public void ImageShouldApplyBackgroundColorFilter()
{ {
const string path = "TestOutput/BackgroundColor"; string path = CreateOutputDirectory("BackgroundColor");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Filters/BinaryThreshold.cs

@ -22,11 +22,7 @@ namespace ImageProcessorCore.Tests
[MemberData("BinaryThresholdValues")] [MemberData("BinaryThresholdValues")]
public void ImageShouldApplyBinaryThresholdFilter(float value) public void ImageShouldApplyBinaryThresholdFilter(float value)
{ {
const string path = "TestOutput/BinaryThreshold"; string path = CreateOutputDirectory("BinaryThreshold");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Filters/BlackWhiteTest.cs

@ -14,11 +14,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyBlackWhiteFilter() public void ImageShouldApplyBlackWhiteFilter()
{ {
const string path = "TestOutput/BlackWhite"; string path = CreateOutputDirectory("BlackWhite");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

8
tests/ImageProcessorCore.Tests/Processors/Filters/BlendTest.cs

@ -14,14 +14,10 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyBlendFilter() public void ImageShouldApplyBlendFilter()
{ {
const string path = "TestOutput/Blend"; string path = CreateOutputDirectory("Blend");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
Image blend; Image blend;
using (FileStream stream = File.OpenRead("TestImages/Formats/Bmp/Car.bmp")) using (FileStream stream = File.OpenRead(TestImages.Bmp.Car))
{ {
blend = new Image(stream); blend = new Image(stream);
} }

6
tests/ImageProcessorCore.Tests/Processors/Filters/BoxBlurTest.cs

@ -22,11 +22,7 @@ namespace ImageProcessorCore.Tests
[MemberData("BoxBlurValues")] [MemberData("BoxBlurValues")]
public void ImageShouldApplyBoxBlurFilter(int value) public void ImageShouldApplyBoxBlurFilter(int value)
{ {
const string path = "TestOutput/BoxBlur"; string path = CreateOutputDirectory("BoxBlur");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Filters/BrightnessTest.cs

@ -22,11 +22,7 @@ namespace ImageProcessorCore.Tests
[MemberData("BrightnessValues")] [MemberData("BrightnessValues")]
public void ImageShouldApplyBrightnessFilter(int value) public void ImageShouldApplyBrightnessFilter(int value)
{ {
const string path = "TestOutput/Brightness"; string path = CreateOutputDirectory("Brightness");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Filters/ColorBlindnessTest.cs

@ -28,11 +28,7 @@ namespace ImageProcessorCore.Tests
[MemberData("ColorBlindnessFilters")] [MemberData("ColorBlindnessFilters")]
public void ImageShouldApplyColorBlindnessFilter(ColorBlindness colorBlindness) public void ImageShouldApplyColorBlindnessFilter(ColorBlindness colorBlindness)
{ {
const string path = "TestOutput/ColorBlindness"; string path = CreateOutputDirectory("ColorBlindness");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Filters/ContrastTest.cs

@ -22,11 +22,7 @@ namespace ImageProcessorCore.Tests
[MemberData("ContrastValues")] [MemberData("ContrastValues")]
public void ImageShouldApplyContrastFilter(int value) public void ImageShouldApplyContrastFilter(int value)
{ {
const string path = "TestOutput/Contrast"; string path = CreateOutputDirectory("Contrast");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

24
tests/ImageProcessorCore.Tests/Processors/Filters/GlowTest.cs

@ -14,11 +14,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyGlowFilter() public void ImageShouldApplyGlowFilter()
{ {
const string path = "TestOutput/Glow"; string path = CreateOutputDirectory("Glow");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -35,11 +31,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyGlowFilterColor() public void ImageShouldApplyGlowFilterColor()
{ {
const string path = "TestOutput/Glow"; string path = CreateOutputDirectory("Glow");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -57,11 +49,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyGlowFilterRadius() public void ImageShouldApplyGlowFilterRadius()
{ {
const string path = "TestOutput/Glow"; string path = CreateOutputDirectory("Glow");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -79,11 +67,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyGlowFilterInBox() public void ImageShouldApplyGlowFilterInBox()
{ {
const string path = "TestOutput/Glow"; string path = CreateOutputDirectory("Glow");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Filters/GrayscaleTest.cs

@ -23,11 +23,7 @@ namespace ImageProcessorCore.Tests
[MemberData("GrayscaleValues")] [MemberData("GrayscaleValues")]
public void ImageShouldApplyGrayscaleFilter(GrayscaleMode value) public void ImageShouldApplyGrayscaleFilter(GrayscaleMode value)
{ {
const string path = "TestOutput/Grayscale"; string path = CreateOutputDirectory("Grayscale");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Filters/HueTest.cs

@ -22,11 +22,7 @@ namespace ImageProcessorCore.Tests
[MemberData("HueValues")] [MemberData("HueValues")]
public void ImageShouldApplyHueFilter(int value) public void ImageShouldApplyHueFilter(int value)
{ {
const string path = "TestOutput/Hue"; string path = CreateOutputDirectory("Hue");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

13
tests/ImageProcessorCore.Tests/Processors/Filters/InvertTest.cs

@ -14,12 +14,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyInvertFilter() public void ImageShouldApplyInvertFilter()
{ {
const string path = "TestOutput/Invert"; string path = CreateOutputDirectory("Invert");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
Image image = file.CreateImage(); Image image = file.CreateImage();
@ -35,11 +30,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyInvertFilterInBox() public void ImageShouldApplyInvertFilterInBox()
{ {
const string path = "TestOutput/Invert"; string path = CreateOutputDirectory("Invert");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Filters/KodachromeTest.cs

@ -14,11 +14,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyKodachromeFilter() public void ImageShouldApplyKodachromeFilter()
{ {
const string path = "TestOutput/Kodachrome"; string path = CreateOutputDirectory("Kodachrome");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

13
tests/ImageProcessorCore.Tests/Processors/Filters/LomographTest.cs

@ -14,11 +14,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyLomographFilter() public void ImageShouldApplyLomographFilter()
{ {
const string path = "TestOutput/Lomograph"; string path = CreateOutputDirectory("Lomograph");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -35,11 +31,8 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyLomographFilterInBox() public void ImageShouldApplyLomographFilterInBox()
{ {
const string path = "TestOutput/Lomograph"; string path = CreateOutputDirectory("Lomograph");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
string filename = file.GetFileName("InBox"); string filename = file.GetFileName("InBox");

6
tests/ImageProcessorCore.Tests/Processors/Filters/PolaroidTest.cs

@ -14,11 +14,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyPolaroidFilter() public void ImageShouldApplyPolaroidFilter()
{ {
const string path = "TestOutput/Polaroid"; string path = CreateOutputDirectory("Polaroid");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Filters/SaturationTest.cs

@ -22,11 +22,7 @@ namespace ImageProcessorCore.Tests
[MemberData("SaturationValues")] [MemberData("SaturationValues")]
public void ImageShouldApplySaturationFilter(int value) public void ImageShouldApplySaturationFilter(int value)
{ {
const string path = "TestOutput/Saturation"; string path = CreateOutputDirectory("Saturation");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Filters/SepiaTest.cs

@ -14,11 +14,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplySepiaFilter() public void ImageShouldApplySepiaFilter()
{ {
const string path = "TestOutput/Sepia"; string path = CreateOutputDirectory("Sepia");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

24
tests/ImageProcessorCore.Tests/Processors/Filters/VignetteTest.cs

@ -14,11 +14,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyVignetteFilter() public void ImageShouldApplyVignetteFilter()
{ {
const string path = "TestOutput/Vignette"; string path = CreateOutputDirectory("Vignette");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -35,11 +31,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyVignetteFilterColor() public void ImageShouldApplyVignetteFilterColor()
{ {
const string path = "TestOutput/Vignette"; string path = CreateOutputDirectory("Vignette");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -57,11 +49,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyVignetteFilterRadius() public void ImageShouldApplyVignetteFilterRadius()
{ {
const string path = "TestOutput/Vignette"; string path = CreateOutputDirectory("Vignette");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -79,11 +67,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyVignetteFilterInBox() public void ImageShouldApplyVignetteFilterInBox()
{ {
const string path = "TestOutput/Vignette"; string path = CreateOutputDirectory("Vignette");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Samplers/AutoOrientTests.cs

@ -28,11 +28,7 @@ namespace ImageProcessorCore.Tests
[MemberData("OrientationValues")] [MemberData("OrientationValues")]
public void ImageShouldFlip(RotateType rotateType, FlipType flipType, ushort orientation) public void ImageShouldFlip(RotateType rotateType, FlipType flipType, ushort orientation)
{ {
const string path = "TestOutput/AutoOrient"; string path = CreateOutputDirectory("AutoOrient");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
string file = TestImages.Bmp.F; string file = TestImages.Bmp.F;

6
tests/ImageProcessorCore.Tests/Processors/Samplers/CropTest.cs

@ -14,11 +14,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyCropSampler() public void ImageShouldApplyCropSampler()
{ {
const string path = "TestOutput/Crop"; string path = CreateOutputDirectory("Crop");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

12
tests/ImageProcessorCore.Tests/Processors/Samplers/DetectEdgesTest.cs

@ -30,11 +30,7 @@ namespace ImageProcessorCore.Tests
[MemberData(nameof(DetectEdgesFilters))] [MemberData(nameof(DetectEdgesFilters))]
public void ImageShouldApplyDetectEdgesFilter(EdgeDetection detector) public void ImageShouldApplyDetectEdgesFilter(EdgeDetection detector)
{ {
const string path = "TestOutput/DetectEdges"; string path = CreateOutputDirectory("DetectEdges");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -53,11 +49,7 @@ namespace ImageProcessorCore.Tests
[MemberData("DetectEdgesFilters")] [MemberData("DetectEdgesFilters")]
public void ImageShouldApplyDetectEdgesFilterInBox(EdgeDetection detector) public void ImageShouldApplyDetectEdgesFilterInBox(EdgeDetection detector)
{ {
const string path = "TestOutput/DetectEdges"; string path = CreateOutputDirectory("DetectEdges");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Samplers/EntropyCropTest.cs

@ -22,11 +22,7 @@ namespace ImageProcessorCore.Tests
[MemberData("EntropyCropValues")] [MemberData("EntropyCropValues")]
public void ImageShouldApplyEntropyCropSampler(float value) public void ImageShouldApplyEntropyCropSampler(float value)
{ {
const string path = "TestOutput/EntropyCrop"; string path = CreateOutputDirectory("EntropyCrop");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Samplers/FlipTests.cs

@ -23,11 +23,7 @@ namespace ImageProcessorCore.Tests
[MemberData("FlipValues")] [MemberData("FlipValues")]
public void ImageShouldFlip(FlipType flipType) public void ImageShouldFlip(FlipType flipType)
{ {
const string path = "TestOutput/Flip"; string path = CreateOutputDirectory("Flip");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Samplers/GuassianBlurTest.cs

@ -22,11 +22,7 @@ namespace ImageProcessorCore.Tests
[MemberData("GuassianBlurValues")] [MemberData("GuassianBlurValues")]
public void ImageShouldApplyGuassianBlurFilter(int value) public void ImageShouldApplyGuassianBlurFilter(int value)
{ {
const string path = "TestOutput/GuassianBlur"; string path = CreateOutputDirectory("GuassianBlur");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Samplers/GuassianSharpenTest.cs

@ -22,11 +22,7 @@ namespace ImageProcessorCore.Tests
[MemberData("GuassianSharpenValues")] [MemberData("GuassianSharpenValues")]
public void ImageShouldApplyGuassianSharpenFilter(int value) public void ImageShouldApplyGuassianSharpenFilter(int value)
{ {
const string path = "TestOutput/GuassianSharpen"; string path = CreateOutputDirectory("GuassianSharpen");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

12
tests/ImageProcessorCore.Tests/Processors/Samplers/OilPaintTest.cs

@ -23,11 +23,7 @@ namespace ImageProcessorCore.Tests
[MemberData(nameof(OilPaintValues))] [MemberData(nameof(OilPaintValues))]
public void ImageShouldApplyOilPaintFilter(Tuple<int, int> value) public void ImageShouldApplyOilPaintFilter(Tuple<int, int> value)
{ {
const string path = "TestOutput/OilPaint"; string path = CreateOutputDirectory("OilPaint");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -46,11 +42,7 @@ namespace ImageProcessorCore.Tests
[MemberData(nameof(OilPaintValues))] [MemberData(nameof(OilPaintValues))]
public void ImageShouldApplyOilPaintFilterInBox(Tuple<int, int> value) public void ImageShouldApplyOilPaintFilterInBox(Tuple<int, int> value)
{ {
const string path = "TestOutput/OilPaint"; string path = CreateOutputDirectory("OilPaint");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Samplers/PadTest.cs

@ -14,11 +14,7 @@ namespace ImageProcessorCore.Tests
[Fact] [Fact]
public void ImageShouldApplyPadSampler() public void ImageShouldApplyPadSampler()
{ {
const string path = "TestOutput/Pad"; string path = CreateOutputDirectory("Pad");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

12
tests/ImageProcessorCore.Tests/Processors/Samplers/PixelateTest.cs

@ -22,11 +22,7 @@ namespace ImageProcessorCore.Tests
[MemberData(nameof(PixelateValues))] [MemberData(nameof(PixelateValues))]
public void ImageShouldApplyPixelateFilter(int value) public void ImageShouldApplyPixelateFilter(int value)
{ {
const string path = "TestOutput/Pixelate"; string path = CreateOutputDirectory("Pixelate");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -45,11 +41,7 @@ namespace ImageProcessorCore.Tests
[MemberData(nameof(PixelateValues))] [MemberData(nameof(PixelateValues))]
public void ImageShouldApplyPixelateFilterInBox(int value) public void ImageShouldApplyPixelateFilterInBox(int value)
{ {
const string path = "TestOutput/Pixelate"; string path = CreateOutputDirectory("Pixelate");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

52
tests/ImageProcessorCore.Tests/Processors/Samplers/ResizeTests.cs

@ -11,8 +11,6 @@ namespace ImageProcessorCore.Tests
public class ResizeTests : FileTestBase public class ResizeTests : FileTestBase
{ {
private const string path = "TestOutput/Resize";
public static readonly TheoryData<string, IResampler> ReSamplers = public static readonly TheoryData<string, IResampler> ReSamplers =
new TheoryData<string, IResampler> new TheoryData<string, IResampler>
{ {
@ -37,10 +35,7 @@ namespace ImageProcessorCore.Tests
[MemberData("ReSamplers")] [MemberData("ReSamplers")]
public void ImageShouldResize(string name, IResampler sampler) public void ImageShouldResize(string name, IResampler sampler)
{ {
if (!Directory.Exists(path)) string path = CreateOutputDirectory("Resize");
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -62,10 +57,7 @@ namespace ImageProcessorCore.Tests
{ {
name = name + "-FixedWidth"; name = name + "-FixedWidth";
if (!Directory.Exists(path)) string path = CreateOutputDirectory("Resize");
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -86,10 +78,7 @@ namespace ImageProcessorCore.Tests
{ {
name = name + "-FixedHeight"; name = name + "-FixedHeight";
if (!Directory.Exists(path)) string path = CreateOutputDirectory("Resize");
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -110,10 +99,7 @@ namespace ImageProcessorCore.Tests
{ {
name = name + "-CropWidth"; name = name + "-CropWidth";
if (!Directory.Exists(path)) string path = CreateOutputDirectory("Resize");
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -140,10 +126,7 @@ namespace ImageProcessorCore.Tests
{ {
name = name + "-CropHeight"; name = name + "-CropHeight";
if (!Directory.Exists(path)) string path = CreateOutputDirectory("Resize");
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -170,10 +153,7 @@ namespace ImageProcessorCore.Tests
{ {
name = name + "-Pad"; name = name + "-Pad";
if (!Directory.Exists(path)) string path = CreateOutputDirectory("Resize");
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -200,10 +180,7 @@ namespace ImageProcessorCore.Tests
{ {
name = name + "-BoxPad"; name = name + "-BoxPad";
if (!Directory.Exists(path)) string path = CreateOutputDirectory("Resize");
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -231,10 +208,7 @@ namespace ImageProcessorCore.Tests
{ {
name = name + "Max"; name = name + "Max";
if (!Directory.Exists(path)) string path = CreateOutputDirectory("Resize");
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -262,10 +236,7 @@ namespace ImageProcessorCore.Tests
{ {
name = name + "-Min"; name = name + "-Min";
if (!Directory.Exists(path)) string path = CreateOutputDirectory("Resize");
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -293,10 +264,7 @@ namespace ImageProcessorCore.Tests
{ {
name = name + "Stretch"; name = name + "Stretch";
if (!Directory.Exists(path)) string path = CreateOutputDirectory("Resize");
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Samplers/RotateFlipTest.cs

@ -25,11 +25,7 @@ namespace ImageProcessorCore.Tests
[MemberData("RotateFlipValues")] [MemberData("RotateFlipValues")]
public void ImageShouldRotateFlip(RotateType rotateType, FlipType flipType) public void ImageShouldRotateFlip(RotateType rotateType, FlipType flipType)
{ {
const string path = "TestOutput/RotateFlip"; string path = CreateOutputDirectory("RotateFlip");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

12
tests/ImageProcessorCore.Tests/Processors/Samplers/RotateTest.cs

@ -31,11 +31,7 @@ namespace ImageProcessorCore.Tests
[MemberData("RotateFloatValues")] [MemberData("RotateFloatValues")]
public void ImageShouldApplyRotateSampler(float value) public void ImageShouldApplyRotateSampler(float value)
{ {
const string path = "TestOutput/Rotate"; string path = CreateOutputDirectory("Rotate");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {
@ -54,11 +50,7 @@ namespace ImageProcessorCore.Tests
[MemberData("RotateEnumValues")] [MemberData("RotateEnumValues")]
public void ImageShouldApplyRotateSampler(RotateType value) public void ImageShouldApplyRotateSampler(RotateType value)
{ {
const string path = "TestOutput/Rotate"; string path = CreateOutputDirectory("Rotate");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
foreach (TestFile file in Files) foreach (TestFile file in Files)
{ {

6
tests/ImageProcessorCore.Tests/Processors/Samplers/SkewTest.cs

@ -22,11 +22,7 @@ namespace ImageProcessorCore.Tests
[MemberData("SkewValues")] [MemberData("SkewValues")]
public void ImageShouldApplySkewSampler(float x, float y) public void ImageShouldApplySkewSampler(float x, float y)
{ {
const string path = "TestOutput/Skew"; string path = CreateOutputDirectory("Skew");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
// Matches live example // Matches live example
// http://www.w3schools.com/css/tryit.asp?filename=trycss3_transform_skew // http://www.w3schools.com/css/tryit.asp?filename=trycss3_transform_skew

Loading…
Cancel
Save