Use CreateLinkedTokenSource to bind to TestContext cancellationtoken

This commit is contained in:
Malte Rosenbjerg 2025-10-27 19:38:58 +01:00
parent 1346049991
commit 919c6ef526

View file

@ -1050,7 +1050,7 @@ public class VideoTest
{
using var outputFile = new TemporaryFile("out.mp4");
var cts = new CancellationTokenSource();
using var cts = CancellationTokenSource.CreateLinkedTokenSource(TestContext.CancellationToken);
var task = FFMpegArguments
.FromFileInput("testsrc2=size=320x240[out0]; sine[out1]", false, args => args
@ -1061,7 +1061,6 @@ public class VideoTest
.WithVideoCodec(VideoCodec.LibX264)
.WithSpeedPreset(Speed.VeryFast))
.CancellableThrough(cts.Token)
.CancellableThrough(TestContext.CancellationToken)
.ProcessAsynchronously(false);
cts.CancelAfter(300);
@ -1077,7 +1076,7 @@ public class VideoTest
{
using var outputFile = new TemporaryFile("out.mp4");
var cts = new CancellationTokenSource();
using var cts = CancellationTokenSource.CreateLinkedTokenSource(TestContext.CancellationToken);
var task = FFMpegArguments
.FromFileInput("testsrc2=size=320x240[out0]; sine[out1]", false, args => args
@ -1088,7 +1087,6 @@ public class VideoTest
.WithVideoCodec(VideoCodec.LibX264)
.WithSpeedPreset(Speed.VeryFast))
.CancellableThrough(cts.Token)
.CancellableThrough(TestContext.CancellationToken)
.ProcessAsynchronously();
cts.CancelAfter(300);
@ -1102,7 +1100,7 @@ public class VideoTest
{
using var outputFile = new TemporaryFile("out.mp4");
var cts = new CancellationTokenSource();
using var cts = CancellationTokenSource.CreateLinkedTokenSource(TestContext.CancellationToken);
var task = FFMpegArguments
.FromFileInput("testsrc2=size=320x240[out0]; sine[out1]", false, args => args
@ -1126,7 +1124,7 @@ public class VideoTest
{
using var outputFile = new TemporaryFile("out.mp4");
var cts = new CancellationTokenSource();
using var cts = CancellationTokenSource.CreateLinkedTokenSource(TestContext.CancellationToken);
cts.Cancel();
var task = FFMpegArguments
@ -1149,7 +1147,7 @@ public class VideoTest
{
using var outputFile = new TemporaryFile("out.mp4");
var cts = new CancellationTokenSource();
using var cts = CancellationTokenSource.CreateLinkedTokenSource(TestContext.CancellationToken);
var task = FFMpegArguments
.FromFileInput("testsrc2=size=320x240[out0]; sine[out1]", false, args => args