Compare commits

...

5 commits

Author SHA1 Message Date
Malte Rosenbjerg
7cad675971
Merge f31dc2b1cd into 71e36847a9 2024-12-04 21:00:30 +01:00
Malte Rosenbjerg
f31dc2b1cd
Merge branch 'main' into bugfix/ensure-ffmpeg-not-found-throws-ffmpegexception 2024-12-04 20:58:27 +01:00
Malte Rosenbjerg
d43ea98e0e
Merge branch 'main' into bugfix/ensure-ffmpeg-not-found-throws-ffmpegexception 2024-12-04 20:55:04 +01:00
Malte Rosenbjerg
508cce8827 Change test path to non-existing directory 2023-02-23 22:00:19 +01:00
Malte Rosenbjerg
349b6044d1 Wrap Instances exception for expected behaviour 2023-02-23 19:18:34 +01:00
2 changed files with 20 additions and 2 deletions

View file

@ -1,6 +1,9 @@
using System.Reflection;
using FFMpegCore.Arguments;
using FFMpegCore.Exceptions;
using FFMpegCore.Helpers;
using FluentAssertions;
using Instances.Exceptions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace FFMpegCore.Test
@ -99,5 +102,12 @@ public void Audible_Aax_Test()
var arg = new AudibleEncryptionKeyArgument("62689101");
arg.Text.Should().Be($"-activation_bytes 62689101");
}
[TestMethod]
public void Throws_FFMpegException_when_ffmpeg_not_found()
{
var exception = Assert.ThrowsException<FFMpegException>(() => FFMpegHelper.VerifyFFMpegExists(new FFOptions { BinaryFolder = "./folder/that/does/not/exist" }));
Assert.IsInstanceOfType<InstanceFileNotFoundException>(exception.InnerException);
}
}
}

View file

@ -42,8 +42,16 @@ public static void VerifyFFMpegExists(FFOptions ffMpegOptions)
return;
}
try
{
var result = Instance.Finish(GlobalFFOptions.GetFFMpegBinaryPath(ffMpegOptions), "-version");
_ffmpegVerified = result.ExitCode == 0;
}
catch (Exception e)
{
throw new FFMpegException(FFMpegExceptionType.Operation, "ffmpeg was not found on your system", e);
}
if (!_ffmpegVerified)
{
throw new FFMpegException(FFMpegExceptionType.Operation, "ffmpeg was not found on your system");