Running NUnit tests in release mode

I have a problem.

#if DEBUG
        ca.ConveyancingAttorneyID = "C0B68DC3-C396-4264-880B-1A699C53A8CE";
        ca.ConveyancingFirmID = "C0B68DC3-C396-4264-880B-1A699C53A8CE";
#endif

When we work in debug mode, we hard code the identifier. In the release, it is clearly dynamically installed.

Now, when it comes to unit testing the matching code, I had to do this: (first, I just tested the “Release Case”, which otherwise would fail in Debug mode)

#if RELEASE
        Guid id = new Guid("1A92CE5A-D956-486B-9B65-0A3630EF0285"); 
#endif
#if DEBUG
        Guid id = new Guid("C0B68DC3-C396-4264-880B-1A699C53A8CE"); 
#endif

This is not perfect. And the need to remember (and remind teammates) to always run Unit Tests in Release is also a problem. We do not have a permanent integration installation, so the tests are performed only locally.

NUnit/Visual Studio Testrunner/Resharper Testrunner Release? , , '#if DEBUG' .

+4
3

, , . , .

- . , , , , .

, , , .

:. , : Resharper > Options > Tools > Unit Testing :, .

, , , VS - , ""?

+1

Release, /config: Release

+3

Remember that case sensitivity matters when using arguments, for example. / config: exempt from Xeon's answer otherwise you get an error:

Invalid : Path_to_your_file
File type is not supported error

(not enough reputation for comments)

0
source

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


All Articles