The Silverlight Unit test Framework defines a process for dealing with Async calls (derive test class from Microsoft.Silverlight.Testing.SilverlightTest, add Asynchronous attribute, use EnqueueXXX methods.) Considering the separation that SpecFlow presents between the test class and the steps:
Using an AutoResetEvent won't work because the WaitOne call will block the UI thread. Silverlight makes use of the UI thread even when making async calls to a data services (see this post - Thead is blocked using WebClient and ManualResetEvent) so the WaitOne will actually stop the service from being called.
I know this is probably to late but here goes.
For silverlight async calls you can use the Specflow AsyncContext api
https://github.com/techtalk/SpecFlow/wiki/Testing-Silverlight-Asynchronous-Code
I blogged about this when it was being developed here
http://rburnham.wordpress.com/2011/05/13/testing-silverlight-asynchronous-code-with-specflow/
It helps to explain the concept.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With