FFMpegCore/FFMpegCore.Test/FFMpegOptionsTests.cs

50 lines
1.3 KiB
C#
Raw Normal View History

2020-05-09 17:53:03 +02:00
using Microsoft.VisualStudio.TestTools.UnitTesting;
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);
}
[TestMethod]
public void Options_Defaults_Configured()
{
2021-03-07 00:26:08 +01:00
Assert.AreEqual(new FFOptions().BinaryFolder, $"");
}
[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
);
}
[TestMethod]
2020-05-12 22:47:57 +02:00
public void Options_Set_Programmatically()
{
2021-03-07 00:26:08 +01:00
var original = GlobalFFOptions.Current;
try
{
2021-03-07 00:26:08 +01:00
GlobalFFOptions.Configure(new FFOptions { BinaryFolder = "Whatever" });
Assert.AreEqual(
2021-03-07 00:26:08 +01:00
GlobalFFOptions.Current.BinaryFolder,
"Whatever"
);
}
finally
{
2021-03-07 00:26:08 +01:00
GlobalFFOptions.Configure(original);
}
}
}
}