FFMpegCore/FFMpegCore.Test/FFMpegOptions.cs
2019-03-04 23:05:01 +02:00

50 lines
1.3 KiB
C#

using FFMpegCore.FFMPEG;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using System.IO;
namespace FFMpegCore.Test
{
[TestClass]
public class FFMpegOptionsTest
{
[TestMethod]
public void Options_Initialized()
{
Assert.IsNotNull(FFMpegOptions.Options);
}
[TestMethod]
public void Options_Defaults_Configured()
{
Assert.AreEqual(new FFMpegOptions().RootDirectory, ".\\FFMPEG\\bin");
}
[TestMethod]
public void Options_Loaded_From_File()
{
Assert.AreEqual(
FFMpegOptions.Options.RootDirectory,
JsonConvert.DeserializeObject<FFMpegOptions>(File.ReadAllText(".\\ffmpeg.config.json")).RootDirectory
);
}
[TestMethod]
public void Options_Overrided()
{
var original = FFMpegOptions.Options;
try
{
FFMpegOptions.Configure(new FFMpegOptions { RootDirectory = "Whatever" });
Assert.AreEqual(
FFMpegOptions.Options.RootDirectory,
"Whatever"
);
}
finally
{
FFMpegOptions.Configure(original);
}
}
}
}