开发者

WP7-Silverlight Asynchronous Unit Test, EnqueueCallBack is not supported by the language?

开发者 https://www.devze.com 2022-12-31 16:20 出处:网络
I am working on a unit test for a Windows Phone 7 Silverlight app. The 开发者_如何学Ccode for the test looks like this:

I am working on a unit test for a Windows Phone 7 Silverlight app. The 开发者_如何学Ccode 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.

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消