Files

31 lines
942 B
C#

using Explorer.Application;
namespace Explorer.Application.Tests;
public class FfmpegLocatorTests
{
[Fact]
public void Prefers_the_configured_path_when_it_exists()
{
var path = @"C:\Tools\ffmpeg.exe";
Assert.Equal(path, FfmpegLocator.Find(path, fileExists: p => p == path, pathVariable: ""));
}
[Fact]
public void Finds_ffmpeg_on_PATH_when_not_configured()
{
var found = FfmpegLocator.Find(
null,
fileExists: p => p.Equals(@"D:\bin\ffmpeg.exe", StringComparison.OrdinalIgnoreCase),
pathVariable: @"C:\Windows;D:\bin");
Assert.Equal(@"D:\bin\ffmpeg.exe", found);
}
[Fact]
public void Returns_null_when_ffmpeg_is_missing()
{
Assert.Null(FfmpegLocator.Find(null, fileExists: _ => false, pathVariable: @"C:\none"));
Assert.Contains("FFmpeg", FfmpegLocator.MissingHint, StringComparison.OrdinalIgnoreCase);
}
}