Silverlight Asynchronous Unit Test

Source: Internet
Author: User
Tags silverlight

Many of the operations in Silverlight are asynchronous and require unit tests to be asynchronous in many cases, but there are few documents that introduce asynchronous unit tests. Through the Microsoft.Silverlight.Testing in the Silverlight Toolkit and Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight the analysis and attempts of these two files, finally found a way to do asynchronous unit testing, if necessary in Silverlight The asynchronous unit tests are used in the project in the following general steps:

Create a new Silverlight project, add a pair of Microsoft.Silverlight.Testing.dll, Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll a reference to a file, this does not have to do too much introduction.

Open the App.xaml.cs file, add a reference to the namespace Microsoft.Silverlight.Testing, locate the Application_Startup method, change the application's rootvisual to a test page, and then delete the Dynamic generated MainPage.xaml file, the modified Application_Startup method is as follows:

Create a new unit test class asynctest, let it inherit from the Microsoft.Silverlight.Testing.SilverlightTest base class, and then add the TestClass tag, as shown in the following illustration of the final file:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.