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()
{
Assert.IsNotNull(FFMpegOptions.Options);
}
[TestMethod]
public void Options_Defaults_Configured()
{
2020-05-12 21:37:10 +02:00
Assert.AreEqual(new FFMpegOptions().RootDirectory, $"");
}
[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
);
}
[TestMethod]
2020-05-12 22:47:57 +02:00
public void Options_Set_Programmatically()
{
var original = FFMpegOptions.Options;
try
{
FFMpegOptions.Configure(new FFMpegOptions { RootDirectory = "Whatever" });
Assert.AreEqual(
FFMpegOptions.Options.RootDirectory,
"Whatever"
);
}
finally
{
FFMpegOptions.Configure(original);
}
}
}
}