Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
natekford committed Jan 25, 2024
1 parent 1ceb419 commit b729f25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/SongProcessor/Utils/ProcessUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static Task<int> RunAsync(this Process process, OutputMode mode)
var tcs = new TaskCompletionSource<int>();

process.EnableRaisingEvents = true;
process.OnComplete(code => tcs.SetResult(code));
process.OnComplete(tcs.SetResult);
process.Start();

if ((mode & OutputMode.Async) != 0)
Expand Down
5 changes: 5 additions & 0 deletions tests/SongProcessor.Tests/FFmpeg/Jobs/VideoSongJob_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,15 @@ public async Task ProcessVideoCanceled_Test()
var job = GenerateJob(temp.Dir, div: 1);
var cts = new CancellationTokenSource();

var sw = System.Diagnostics.Stopwatch.StartNew();

var task = job.ProcessAsync(cts.Token);
Console.WriteLine($"started: {sw.ElapsedMilliseconds}ms");
cts.Cancel();
Console.WriteLine($"cancelled: {sw.ElapsedMilliseconds}ms");

var result = await task.ConfigureAwait(false);
Console.WriteLine($"awaited: {sw.ElapsedMilliseconds}ms");
result.IsSuccess.Should().BeNull();
result.Should().BeOfType<Canceled>();
}
Expand Down

0 comments on commit b729f25

Please sign in to comment.