Fix tests

Former-commit-id: f22c506f46
This commit is contained in:
Malte Rosenbjerg 2020-05-11 00:02:35 +02:00
parent 209b8d8dd6
commit 9115485464
2 changed files with 24 additions and 16 deletions

View file

@ -285,26 +285,28 @@ public void Video_ToMP4_Args_StreamPipe()
[TestMethod, Timeout(45000)]
public void Video_ToMP4_Args_StreamOutputPipe_Async_Failure()
{
Assert.ThrowsException<FFMpegException>(() =>
{
using var ms = new MemoryStream();
var pipeSource = new StreamPipeDataReader(ms);
FFMpegArguments
.FromInputFiles(VideoLibrary.LocalVideo)
.ForceFormat("mkv")
.OutputToPipe(pipeSource)
.ProcessAsynchronously()
.WaitForResult();
});
using var ms = new MemoryStream();
var pipeSource = new StreamPipeDataReader(ms);
var result = FFMpegArguments
.FromInputFiles(VideoLibrary.LocalVideo)
.ForceFormat("mkv")
.OutputToPipe(pipeSource)
.ProcessAsynchronously()
.WaitForResult();
Assert.IsFalse(result);
}
[TestMethod, Timeout(45000)]
public void Video_ToMP4_Args_StreamOutputPipe_Failure()
{
Assert.ThrowsException<FFMpegException>(() =>
{
ConvertToStreamPipe(new ForceFormatArgument("mkv"));
});
using var ms = new MemoryStream();
var pipeSource = new StreamPipeDataReader(ms);
var result = FFMpegArguments
.FromInputFiles(VideoLibrary.LocalVideo)
.ForceFormat("mkv")
.OutputToPipe(pipeSource)
.ProcessSynchronously();
Assert.IsFalse(result);
}

View file

@ -36,7 +36,13 @@ public void Post()
public async Task During(CancellationToken? cancellationToken = null)
{
await ProcessDataAsync(cancellationToken ?? CancellationToken.None).ConfigureAwait(false);
try
{
await ProcessDataAsync(cancellationToken ?? CancellationToken.None).ConfigureAwait(false);
}
catch (TaskCanceledException)
{
}
Post();
}