简体   繁体   中英

Same unit tests for .NET 2.0 / Silverlight / Windows Phone 7 projects

I have a plenty of tests for my .NET 2.0 project (I use NUnit for them).

Recently, I ported the project to Silverlight 3 and plan to build WP7 version from the same code base, too. Of course, I am interested in running the same tests against Silverlight / WP7 versions.

I setup nunit-silverlight for the task but soon discovered that following constructs are not supported:

[TestCaseSource("ArrayOfStrings")]
public void TestTheArg(string arg)
{
    ...
}

because there is no support for TestCaseSource attribute in nunit-silverlight.

Should I migrate to other testing framework or is there any possibility to make nunit-silverlight run the same tests?

If I should migrate then please recommend a testing framework that can be used to run the same tests against .NET 2.0 / Silverlight / WP7 frameworks.

I have the same problem. obviously TestCaseSource is not supported in the nunit-silverlight, you can use the TestCaseAttribute instead of it.

Without knowing precisely what TestCaseSource does, I would say, it's probably not available due to the limited reflection API for Windows Phone.

The Silverlight Toolkit contains a version of MS Test that can be used on Windows Phone. So you could migrate your tests there, and they should be compatible with Silverlight / .NET 2.0.

But I personally haven't tried testing the Silverlight Toolkit implementation against other platforms.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM