From beaff334b5a928dcb873bcb7452244eb8feed3c9 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sun, 17 Jun 2018 19:23:57 +0200 Subject: [PATCH] clean-up and isolate image load tests --- tests/ImageSharp.Tests/TestFormat.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/ImageSharp.Tests/TestFormat.cs b/tests/ImageSharp.Tests/TestFormat.cs index 70e6c498a4..64357a17e1 100644 --- a/tests/ImageSharp.Tests/TestFormat.cs +++ b/tests/ImageSharp.Tests/TestFormat.cs @@ -18,13 +18,10 @@ namespace SixLabors.ImageSharp.Tests /// public class TestFormat : IConfigurationModule, IImageFormat { + // We should not change Configuration.Default in individual tests! + // Create new configuration instances with new Configuration(TestFormat.GlobalTestFormat) instead! public static TestFormat GlobalTestFormat { get; } = new TestFormat(); - public static void RegisterGlobalTestFormat() - { - Configuration.Default.Configure(GlobalTestFormat); - } - public TestFormat() { this.Encoder = new TestEncoder(this); @@ -155,12 +152,12 @@ public class TestHeader : IImageFormatDetector private TestFormat testFormat; - public int HeaderSize => testFormat.HeaderSize; + public int HeaderSize => this.testFormat.HeaderSize; public IImageFormat DetectFormat(ReadOnlySpan header) { - if (testFormat.IsSupportedFileFormat(header)) - return testFormat; + if (this.testFormat.IsSupportedFileFormat(header)) + return this.testFormat; return null; }