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()
|
|
|
|
|
{
|
|
|
|
|
Assert.IsNotNull(FFMpegOptions.Options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Options_Defaults_Configured()
|
|
|
|
|
{
|
2020-05-12 21:37:10 +02:00
|
|
|
|
Assert.AreEqual(new FFMpegOptions().RootDirectory, $"");
|
2019-03-04 21:56:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Options_Loaded_From_File()
|
|
|
|
|
{
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
FFMpegOptions.Options.RootDirectory,
|
2020-05-12 21:37:10 +02:00
|
|
|
|
JsonConvert.DeserializeObject<FFMpegOptions>(File.ReadAllText("ffmpeg.config.json")).RootDirectory
|
2019-03-04 21:56:37 +01:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|