C# Класс Microsoft.Silverlight.Testing.WorkItemTest

Custom test class that provides the ability to perform semi-asynchronous test tasks on the main thread. Requires the custom unit test harness that manages and invokes test work items on the thread when needed. Tests using this functionality will not be compatible with the full desktop framework's Visual Studio Team Test environment.
Наследование: CustomFrameworkUnitTest
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
EnqueueCallback ( ) : void

Adds a number of callback methods into the test task queue.

EnqueueCallback ( System.Action testCallbackDelegate ) : void

Add a Callback method into the test task queue. Similar to the PumpMessages(...) call, with the difference being that there is no longer a single requirement: you can enqueue several callback methods and other test tasks, all of which will execute before the test completes and/or the engine continues.

EnqueueConditional ( Func conditionalDelegate ) : void

Requires a bool returning delegate to be passed in. Instructs the test task queue to wait until the conditional call returns True to continue executing other test tasks and/or ending the test method.

EnqueueDelay ( System.TimeSpan delay ) : void

Delay a minimum amount of time before continuing. Similar to a sleep call that is not a blocking call.

EnqueueDelay ( double milliseconds ) : void

Delay a minimum amount of time before continuing. Similar to a sleep call that is not a blocking call.

EnqueueTestComplete ( ) : void

Enqueue a test task which calls the TestComplete method of SilverlightTest.

EnqueueWorkItem ( WorkItem testTaskObject ) : void

Add a task object to the test queue. For a test that is currently executing, all tasks contained within the queue are executed to completion (unless an Exception is thrown) -before- moving on to the next test. The test task queue replaces the PumpMessages(...) system that permitted a single callback. This enables specialized tasks, such as DOM bridge tasks, sleep tasks, and conditional continue tasks.

TestComplete ( ) : void

Signal that a test is complete when using Async testing. WARNING: If you use your own methods for completing, such as an HtmlTimer or other threading method, it is possible that this call will occur *AFTER* the test has timed out when using Timeouts. As such, be very careful as you could complete the call to the *next* test.

Приватные методы

Метод Описание
CreateCallback ( System.Action testCallbackDelegate ) : WorkItem
CreateConditional ( Func conditionalDelegate ) : WorkItem
CreateDelay ( System.TimeSpan delay ) : WorkItem
Enqueue ( System.Action action ) : void
EnqueueSleep ( int sleepMillisecondsMinimum ) : void
Sleep ( int sleepMillisecondsMinimum, System.Action testCallback ) : void

Описание методов

EnqueueCallback() публичный Метод

Adds a number of callback methods into the test task queue.
public EnqueueCallback ( ) : void
Результат void

EnqueueCallback() публичный Метод

Add a Callback method into the test task queue. Similar to the PumpMessages(...) call, with the difference being that there is no longer a single requirement: you can enqueue several callback methods and other test tasks, all of which will execute before the test completes and/or the engine continues.
public EnqueueCallback ( System.Action testCallbackDelegate ) : void
testCallbackDelegate System.Action Void-returning delegate, /// anonymous delegates work fine too.
Результат void

EnqueueConditional() публичный Метод

Requires a bool returning delegate to be passed in. Instructs the test task queue to wait until the conditional call returns True to continue executing other test tasks and/or ending the test method.
public EnqueueConditional ( Func conditionalDelegate ) : void
conditionalDelegate Func Conditional method or delegate. /// Test will halt until this condition returns True.
Результат void

EnqueueDelay() публичный Метод

Delay a minimum amount of time before continuing. Similar to a sleep call that is not a blocking call.
public EnqueueDelay ( System.TimeSpan delay ) : void
delay System.TimeSpan The minimum time span to wait before continuing.
Результат void

EnqueueDelay() публичный Метод

Delay a minimum amount of time before continuing. Similar to a sleep call that is not a blocking call.
public EnqueueDelay ( double milliseconds ) : void
milliseconds double The minimum number of milliseconds to wait /// until the delay is finished.
Результат void

EnqueueTestComplete() публичный Метод

Enqueue a test task which calls the TestComplete method of SilverlightTest.
public EnqueueTestComplete ( ) : void
Результат void

EnqueueWorkItem() публичный Метод

Add a task object to the test queue. For a test that is currently executing, all tasks contained within the queue are executed to completion (unless an Exception is thrown) -before- moving on to the next test. The test task queue replaces the PumpMessages(...) system that permitted a single callback. This enables specialized tasks, such as DOM bridge tasks, sleep tasks, and conditional continue tasks.
public EnqueueWorkItem ( WorkItem testTaskObject ) : void
testTaskObject WorkItem Asynchronous test task /// instance.
Результат void

TestComplete() публичный Метод

Signal that a test is complete when using Async testing. WARNING: If you use your own methods for completing, such as an HtmlTimer or other threading method, it is possible that this call will occur *AFTER* the test has timed out when using Timeouts. As such, be very careful as you could complete the call to the *next* test.
public TestComplete ( ) : void
Результат void