Easy unit testing of null argument validation (C# 8 edition) -

added by DotNetKicks
11/19/2019 7:09:45 AM

891 Views

A few years ago, I blogged about a way to automate unit testing of null argument validation. Its usage looked like this: Basically, for each of the specified parameters, the AssertThrowsWhenArgumentNull method rewrites the lambda expression by replacing the corresponding argument with null, compiles and executes it, and checks that it throws an ArgumentNullException with ...


0 comments