Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Portable Class Library Testing

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?

like image 217
jbtule Avatar asked Jun 06 '13 22:06

jbtule


People also ask

What is a portable class library?

Portable class libraries It is a class library that you write and can use in applications that run on multiple platforms. Their purpose is to share code between applications, just like .

What is a PCL project?

PCL projects target specific profiles that support a known set of BCL classes/features. However, the down side to PCL is that they often require extra architectural effort to separate profile specific code into their own libraries.

What is the difference between the portable class library and shared projects?

The difference between a shared project and a class library is that the latter is compiled and the unit of reuse is the assembly. Whereas with the former, the unit of reuse is the source code, and the shared code is incorporated into each assembly that references the shared project.

What is a class library used for?

A class library is a collection of books kept in the classroom and used for extensive reading, not generally for classroom activities. A classroom library can include readers, the teacher's own books, and books lent by learners.


1 Answers

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.

like image 159
jbtule Avatar answered Sep 17 '22 14:09

jbtule