views:

277

answers:

1

I am working on a unit test for a Windows Phone 7 Silverlight app. The code for the test looks like this:

[TestMethod]
[Asynchronous]
public void StuffIsLoading()
{
    WaitFor(_repository, "LoadingStuffComplete");
    var viewModel = new MainPageViewModel(_repository);            
    EnqueueCallback(() => Assert.IsTrue(viewModel.Stuff.Count > 0));
    EnqueueTestComplete();
}

This is based on an old blog post by Justin Angel located here:http://bit.ly/34LQXP

I am using the Silverlight testing framework that was released with the latest Silverlight Toolkit. When I build this I get the following compiler error:

'EnqueueCallback' is not supported by the language

I'm new to Silverlight and WP7 development so what am I missing? Is there a better way to test async operations with events?

+2  A: 

You can't use the latest toolkit: that toolkit was designed for Silverlight 4, and is compiled for use in a CLR 4-like manner.

For now the only bits available are the unsigned ones at http://jeffatmix.com/, hopefully we'll get more official ones out there at some point.

Jeff Wilcox