reset GlobalFFOptions to null after testing

Former-commit-id: 8cacf074fd
This commit is contained in:
BobSilent 2021-11-18 23:59:15 +01:00
parent c04546a156
commit ce71aaab78

View file

@ -1,11 +1,19 @@
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using FluentAssertions; using FluentAssertions;
using System.Reflection;
namespace FFMpegCore.Test namespace FFMpegCore.Test
{ {
[TestClass] [TestClass]
public class FFMpegArgumentProcessorTest 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 private static FFMpegArgumentProcessor CreateArgumentProcessor() => FFMpegArguments
.FromFileInput("") .FromFileInput("")
@ -15,7 +23,6 @@ private static FFMpegArgumentProcessor CreateArgumentProcessor() => FFMpegArgume
[TestMethod] [TestMethod]
public void Processor_GlobalOptions_GetUsed() public void Processor_GlobalOptions_GetUsed()
{ {
var globalWorkingDir = "Whatever"; var globalWorkingDir = "Whatever";
GlobalFFOptions.Configure(new FFOptions { WorkingDirectory = globalWorkingDir }); GlobalFFOptions.Configure(new FFOptions { WorkingDirectory = globalWorkingDir });
@ -27,7 +34,6 @@ public void Processor_GlobalOptions_GetUsed()
[TestMethod] [TestMethod]
public void Processor_SessionOptions_GetUsed() public void Processor_SessionOptions_GetUsed()
{ {
var sessionWorkingDir = "./CurrentRunWorkingDir"; var sessionWorkingDir = "./CurrentRunWorkingDir";
var processor = CreateArgumentProcessor(); var processor = CreateArgumentProcessor();