问题
I'm creating a component for the Xamarin Component Store, providing a Library for Android and iOS. I've put NUnit tests into both library projects but I can't run the unit tests. Is it possible to execute tests in a Android/iOS library project?
回答1:
If you make your library a PCL, you can create a NUnit project that links to the PCL and run your tests that way: https://dzwonsemrish7.cloudfront.net/items/0H3W383D2e031q1p3s40/Screen%20Shot%202013-08-12%20at%207.56.05%20PM.png?v=d5aac873
Xamarin also provides a NUnitLite test runner for iOS: http://docs.xamarin.com/guides/ios/deployment,_testing,_and_metrics/touch.unit
With the latest version of Xamarin Studio you can also create an Android Unit Test project: https://dzwonsemrish7.cloudfront.net/items/3v3x192S473g182C2S2a/Screen%20Shot%202013-08-12%20at%207.55.41%20PM.png?v=f0dce0f9
来源:https://stackoverflow.com/questions/18175191/how-to-run-unit-tests-for-xamarin-library-projects-ios-and-android