From 8cacf074fd830032279df9f05d88b0472e5ac011 Mon Sep 17 00:00:00 2001 From: BobSilent Date: Thu, 18 Nov 2021 23:59:15 +0100 Subject: [PATCH] reset GlobalFFOptions to null after testing --- FFMpegCore.Test/FFMpegArgumentProcessorTest.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/FFMpegCore.Test/FFMpegArgumentProcessorTest.cs b/FFMpegCore.Test/FFMpegArgumentProcessorTest.cs index 08de91c..dc65489 100644 --- a/FFMpegCore.Test/FFMpegArgumentProcessorTest.cs +++ b/FFMpegCore.Test/FFMpegArgumentProcessorTest.cs @@ -1,11 +1,19 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using FluentAssertions; +using System.Reflection; namespace FFMpegCore.Test { [TestClass] public class FFMpegArgumentProcessorTest { + [TestCleanup] + public void TestInitialize() + + { + // After testing reset global configuration to null, to be not wrong for other test relying on configuration + typeof(GlobalFFOptions).GetField("_current", BindingFlags.NonPublic | BindingFlags.Static).SetValue(GlobalFFOptions.Current, null); + } private static FFMpegArgumentProcessor CreateArgumentProcessor() => FFMpegArguments .FromFileInput("") @@ -15,7 +23,6 @@ private static FFMpegArgumentProcessor CreateArgumentProcessor() => FFMpegArgume [TestMethod] public void Processor_GlobalOptions_GetUsed() { - var globalWorkingDir = "Whatever"; GlobalFFOptions.Configure(new FFOptions { WorkingDirectory = globalWorkingDir }); @@ -27,7 +34,6 @@ public void Processor_GlobalOptions_GetUsed() [TestMethod] public void Processor_SessionOptions_GetUsed() { - var sessionWorkingDir = "./CurrentRunWorkingDir"; var processor = CreateArgumentProcessor();