using NUnit.Framework; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Threading; namespace Vanara.IO.Tests { partial class BackgroundCopyTests { [Test] public void CopyAsyncReportTest() { using var tempRoot = new TemporaryDirectory(); var srcFile = tempRoot.CreateFile().FullName; var dstFile = tempRoot.RandomTxtFileFullPath; using var cts = new CancellationTokenSource(); var collection = new Collection(); var prog = new Progress>(t => collection.Add($"{t.Item2}% : {t.Item1}")); Assert.That(() => BackgroundCopyManager.CopyAsync(srcFile, dstFile, cts.Token, prog), Throws.Nothing); Assert.That(File.Exists(dstFile), Is.True); Assert.That(collection.Count, Is.GreaterThan(0)); TestContext.Write(string.Join("\r\n", collection)); } } }