Files
mono/mcs/class/System/Test/System.ComponentModel/BackgroundWorkerTest.cs
T
Atsushi Eno 044c5019fa 2007-08-01 Atsushi Enomoto <[email protected]>
* 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
2007-08-01 09:14:28 +00:00

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