mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-14 01:55:45 +00:00
Improve reset of GlobalOptions
This commit is contained in:
parent
9765b78d48
commit
012a5ca74a
1 changed files with 8 additions and 14 deletions
|
|
@ -1,19 +1,10 @@
|
||||||
using System.Reflection;
|
using FFMpegCore.Arguments;
|
||||||
using FFMpegCore.Arguments;
|
|
||||||
|
|
||||||
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()
|
private static FFMpegArgumentProcessor CreateArgumentProcessor()
|
||||||
{
|
{
|
||||||
return FFMpegArguments
|
return FFMpegArguments
|
||||||
|
|
@ -37,7 +28,7 @@ public class FFMpegArgumentProcessorTest
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
GlobalFFOptions.Configure(new FFOptions { WorkingDirectory = string.Empty });
|
GlobalFFOptions.Configure(new FFOptions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,13 +61,16 @@ public class FFMpegArgumentProcessorTest
|
||||||
GlobalFFOptions.Configure(new FFOptions { WorkingDirectory = globalConfig, TemporaryFilesFolder = globalConfig, BinaryFolder = globalConfig });
|
GlobalFFOptions.Configure(new FFOptions { WorkingDirectory = globalConfig, TemporaryFilesFolder = globalConfig, BinaryFolder = globalConfig });
|
||||||
var options = processor.GetConfiguredOptions(overrideOptions);
|
var options = processor.GetConfiguredOptions(overrideOptions);
|
||||||
|
|
||||||
Assert.AreSame(options, overrideOptions);
|
Assert.AreEqual(options.WorkingDirectory, overrideOptions.WorkingDirectory);
|
||||||
|
Assert.AreEqual(options.TemporaryFilesFolder, overrideOptions.TemporaryFilesFolder);
|
||||||
|
Assert.AreEqual(options.BinaryFolder, overrideOptions.BinaryFolder);
|
||||||
|
|
||||||
Assert.AreEqual(sessionTempDir, options.TemporaryFilesFolder);
|
Assert.AreEqual(sessionTempDir, options.TemporaryFilesFolder);
|
||||||
Assert.AreNotEqual(globalConfig, options.BinaryFolder);
|
Assert.AreNotEqual(globalConfig, options.BinaryFolder);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
GlobalFFOptions.Configure(new FFOptions { WorkingDirectory = string.Empty });
|
GlobalFFOptions.Configure(new FFOptions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,7 +94,7 @@ public class FFMpegArgumentProcessorTest
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
GlobalFFOptions.Configure(new FFOptions { WorkingDirectory = string.Empty });
|
GlobalFFOptions.Configure(new FFOptions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue