Portable Class Library Testing

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 20:00:36

问题


So when testing a Portable Class Library without any platform specific code, is testing against just one of the platforms (.net 4.5) from the profile enough? My intuition says no, but I've read some claims otherwise.

And if you do need to test against each platform, do any of the multitude of test frameworks out there for .net have a PCL testing library with runners for each or most platforms, so only one DLL of unit tests would be necessary?


回答1:


It's usually best to test on all platforms. Right now I'm not aware of any test framework/runner that supports this. I'm hoping to help xUnit do so.

I've done a very simple implementation of a test framework for my PCL Storage library. So you could use that to get you started running tests on all the platforms.




回答2:


I've created a project PclUnit to solve this in a way that you only need to create one Test project and can run it under one runner and it will test on multiple platforms.

It needs more work, and I need help from others to make it happen, but on windows it currently will test .net40-x85, .net40-x64, .net45-x86, .net45-x64, silverlight5-x86, and silverlight5-x64 all at once and aggregate the results.

It does build and run on mono 3.1.2, however each runner has to be run individually until I can get signalr working on mono. I hope to get a proof of concept iOS runner working soon.

Functionally it's similar to xunit's design, but syntactically it's more similar to nunit (includes nunit constraints ported over), but under the PclUnit.Style.Xunit namespace it changes to xunit labels and assertions.




回答3:


xUnit has implemented support for PCL: http://xunit.github.io/



来源:https://stackoverflow.com/questions/16973411/portable-class-library-testing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!