mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 03:51:19 -10:00
* BackgroundWorker.cs : remove extra MonoTODOs. * BackgroundWorkerTest.cs : new test to clear some doubts on impl. * System_test.dll.sources : added BackgroundWorkerTest.cs. svn path=/trunk/mcs/; revision=83156
62 lines
1.2 KiB
C#
62 lines
1.2 KiB
C#
//
|
|
// BackgroundWorkerTest.cs
|
|
//
|
|
// Author:
|
|
// Atsushi Enomoto <[email protected]>
|
|
//
|
|
// Copyright (C) 2007 Novell, Inc.
|
|
//
|
|
|
|
#if NET_2_0
|
|
|
|
using System;
|
|
using System.ComponentModel;
|
|
using System.Globalization;
|
|
|
|
using NUnit.Framework;
|
|
|
|
namespace MonoTests.System.ComponentModel
|
|
{
|
|
[TestFixture]
|
|
public class BackgroundWorkerTest
|
|
{
|
|
[Test]
|
|
[ExpectedException (typeof (InvalidOperationException))]
|
|
public void ReportProgressNoReportingSupported ()
|
|
{
|
|
BackgroundWorker b = new BackgroundWorker ();
|
|
Assert.IsFalse (b.IsBusy, "#1");
|
|
b.ReportProgress (0);
|
|
}
|
|
|
|
[Test]
|
|
public void ReportProgressNonBusy ()
|
|
{
|
|
BackgroundWorker b = new BackgroundWorker ();
|
|
b.WorkerReportsProgress = true;
|
|
Assert.IsFalse (b.IsBusy, "#1");
|
|
b.ReportProgress (0);
|
|
}
|
|
|
|
[Test]
|
|
[ExpectedException (typeof (InvalidOperationException))]
|
|
public void CancelAsyncNoCancellationSupported ()
|
|
{
|
|
BackgroundWorker b = new BackgroundWorker ();
|
|
Assert.IsFalse (b.IsBusy, "#1");
|
|
b.CancelAsync ();
|
|
}
|
|
|
|
[Test]
|
|
public void CancelAsyncNonBusy ()
|
|
{
|
|
BackgroundWorker b = new BackgroundWorker ();
|
|
b.WorkerSupportsCancellation = true;
|
|
Assert.IsFalse (b.IsBusy, "#1");
|
|
b.CancelAsync ();
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif
|