CSharpTest.Net
AddWork(IWaitAndContinue) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Threading Namespace > WaitAndContinueList Class > AddWork Method : AddWork(IWaitAndContinue) Method

item

Glossary Item Box

Adds a unit of work to the list

Syntax

Visual Basic (Declaration) 
Public Overloads Sub AddWork( _
   ByVal item As IWaitAndContinue _
) 
C# 
public void AddWork( 
   IWaitAndContinue item
)

Parameters

item

Exceptions

ExceptionDescription
System.ObjectDisposedExceptionThe exception that is thrown when an operation is performed on a disposed object.

Example

Library/Library.Test/TestWaitAndContinue.cs

C#Copy Code
WaitAndContinueList work = new WaitAndContinueList();
SampleWork item = new SampleWork();

Assert.IsFalse(item.Disposed);
work.AddWork(item);

Assert.IsFalse(work.PerformWork(0));
item.Dispose();

Assert.IsFalse(work.PerformWork(0));

item.Completed = true;//Normally this would be set in the Dispose method of the WorkItem, but we are testing
Assert.IsFalse(work.PerformWork(0));

Assert.IsTrue(work.IsEmpty);
Assert.IsTrue(item.Disposed);
VB.NETCopy Code
Dim work As New WaitAndContinueList()
Dim item As New SampleWork()

Assert.IsFalse(item.Disposed)
work.AddWork(item)

Assert.IsFalse(work.PerformWork(0))
item.Dispose()

Assert.IsFalse(work.PerformWork(0))

item.Completed = True
'Normally this would be set in the Dispose method of the WorkItem, but we are testing
Assert.IsFalse(work.PerformWork(0))

Assert.IsTrue(work.IsEmpty)
Assert.IsTrue(item.Disposed)

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys