Group Testing WPF / Silverlight Hybrid Controls

I am starting a new WPF / Silverlight user control project and wanted to do unit testing on this. However, I am a little confused about how to approach this.

This control will be based on the same code base for both WPF and Silverlight with a bit of forcing using #if and partial classes to tame the differences. I think I could write unit tests for the WPF part using NUnit, MSTest, xUnit, etc., And for the Silverlight part with the Silverlight Unit Test Framework, but this is not very elegant for me. I would either have to ignore testing identical code on one of the platforms, and test only different parts (which is not very reliable) or rewrite tests for 2 frameworks (which is annoying). Is this the right way?

I am wondering if there are any manuals, articles, tutorials on how to approach this task. Any pointers?

+3
source share
2 answers

At first I tried to use xUnit, but it was difficult to do the same tests in xUnit and SLUT (different attributes, syntax, etc.)

Then I did some basic experimentation with MSTest and with a very simple test, it looks like you can successfully use MSTest for part of WPF and the same code with some #if, etc. and SLUT for the Silverlight part. Therefore, I will try to go this route and see how it works in real situations.

0
source

I am hardly an expert in WPF and Silverlight, but would it not be possible to write tests using the same methods as the production code (#ifs and partial classes, as you said)?

0
source

Source: https://habr.com/ru/post/1749393/


All Articles