forked from xerxesb/SpecFlow
-
Notifications
You must be signed in to change notification settings - Fork 0
Testing Silverlight Asynchronous Code
gasparnagy edited this page Feb 1, 2012
·
4 revisions
Coming! Version 1.7 will also support testing Silverlight asynchronous code with the help of the Silverlight Unit Test Framework. You can read about the background Ryan's post.
The facts (please consider them as beta):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="specFlow"
type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/>
</configSections>
<specFlow>
<unitTestProvider name="MSTest.Silverlight4" />
<generator generateAsyncTests="true" />
</specFlow>
</configuration>
The async support provides you several API methods for doing that.
API Method | Description | |
---|---|---|
void EnqueueCallback(Action callback) | Enqueues an action to be executed asynchronously. | |
void EnqueueCallback(params Action[] callbacks) | Enqueues a number of actions to be executed asynchronously, but consecutively. | |
void EnqueueConditional(Func continueUntil) | Enqueues an asynchronous and non-blocking wait until the condition returns true. The `continueUntil` predicate that must return true before the work queue is continued. | |
void EnqueueDelay(TimeSpan delay) | Enqueues an asynchronous and non-blocking wait for at least the given time before continuing. The delay is approximate, and not intended to be highly accurate. | |
void EnqueueDelay(double milliseconds) | Enqueues an asynchronous and non-blocking wait for at least the given time before continuing. The delay is approximate, and not intended to be highly accurate. |
For accessing these API methods, you have two options currently.
- Derive your step binding class from
TechTalk.SpecFlow.Async.AsyncSteps
and use the methods inherited from the base class. - Use
AsyncContext.Current
to access the API methods.