public void CancellationWorks() { var bwr = new BackgroundWorkerReporter(new BackgroundWorker()); bwr.AllowCancellation = true; bwr.Worker.CancelAsync(); Assert.IsTrue(bwr.WasCanceled); }
public void ProgressWorks() { var bwr = new BackgroundWorkerReporter(new BackgroundWorker()); int workerProgress = -1; bwr.Worker.ProgressChanged += (s, e) => { workerProgress = e.ProgressPercentage; }; bwr.Maximum = 50; bwr.Progress = 10; Assert.AreEqual(20, workerProgress); }