2020-05-09 17:53:03 +02:00
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
2019-03-04 21:56:37 +01:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace FFMpegCore.Test
|
|
|
|
|
{
|
|
|
|
|
[TestClass]
|
|
|
|
|
public class FFMpegOptionsTest
|
|
|
|
|
{
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Options_Initialized()
|
|
|
|
|
{
|
2021-03-07 00:26:08 +01:00
|
|
|
|
Assert.IsNotNull(GlobalFFOptions.Current);
|
2019-03-04 21:56:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Options_Defaults_Configured()
|
|
|
|
|
{
|
2021-03-07 00:26:08 +01:00
|
|
|
|
Assert.AreEqual(new FFOptions().BinaryFolder, $"");
|
2019-03-04 21:56:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Options_Loaded_From_File()
|
|
|
|
|
{
|
|
|
|
|
Assert.AreEqual(
|
2021-03-07 00:26:08 +01:00
|
|
|
|
GlobalFFOptions.Current.BinaryFolder,
|
|
|
|
|
JsonConvert.DeserializeObject<FFOptions>(File.ReadAllText("ffmpeg.config.json")).BinaryFolder
|
2019-03-04 21:56:37 +01:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
2020-05-12 22:47:57 +02:00
|
|
|
|
public void Options_Set_Programmatically()
|
2019-03-04 21:56:37 +01:00
|
|
|
|
{
|
2021-03-07 00:26:08 +01:00
|
|
|
|
var original = GlobalFFOptions.Current;
|
2019-03-04 21:56:37 +01:00
|
|
|
|
try
|
|
|
|
|
{
|
2021-03-07 00:26:08 +01:00
|
|
|
|
GlobalFFOptions.Configure(new FFOptions { BinaryFolder = "Whatever" });
|
2019-03-04 21:56:37 +01:00
|
|
|
|
Assert.AreEqual(
|
2021-03-07 00:26:08 +01:00
|
|
|
|
GlobalFFOptions.Current.BinaryFolder,
|
2019-03-04 21:56:37 +01:00
|
|
|
|
"Whatever"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
2021-03-07 00:26:08 +01:00
|
|
|
|
GlobalFFOptions.Configure(original);
|
2019-03-04 21:56:37 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|