你的位置: 码友网首页 / 资讯源列表 / Easy unit testing of null argument validation (C# 8 edition)

关于[Easy unit testing of null argument validation (C# 8 edition)]的摘要:

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 the appropriate parameter name. This method has served me well for many years, as it drastically reduces the amount of code to test argument validation. However, I wasn’t completely satisfied with it, because I still had to specify the names of the non-nullable parameters explicitly…

原文地址: https://thomaslevesque.com/2019/11/19/easy-unit-testing-of-null-argument-validation-c-8-edition/

收录时间: 2019-11-20 浏览量: 1273 分类: C#开发

| 0 收藏 | 0