I have a problem.
#if DEBUG
ca.ConveyancingAttorneyID = "C0B68DC3-C396-4264-880B-1A699C53A8CE";
ca.ConveyancingFirmID = "C0B68DC3-C396-4264-880B-1A699C53A8CE";
#endif
When we are running in debug mode, we hardcode the identifier. In release, it's obviously dynamically set.
Now when it comes to unit testing the mapping code, I've had to do this : (initially I just tested the 'Release case', which would then always 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 ideal. And having to remember (and remind teammates) to always run the Unit Tests in Release is also a hassle. We don't have a continuous integration setup, so the tests are only ever run locally.
Is there a way to force NUnit / Visual Studio Testrunner / Resharper Testrunner to always run tests in Release mode? Or is there a better way to approach this, keeping in mind that these kind of '#if DEBUG' codeblocks are quite abundant in the solution.
If you must run Release, use argument /config:Release
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With