Tag: Testing

Be careful in using the C# null conditional operators in tests

Dangerous use of null C# conditional operator in test

Few days ago, I come across to a bunch of tests that were using the null conditional operator in the wrong way and I think it is worth sharing it. Have a look at this code and how I fixed it.What’s the problem with the original code?  When result is null, the test pass even if …

Continue reading

Permanent link to this article: https://www.productivecsharp.com/2018/01/careful-using-c-null-conditional-operators-tests/