你的位置: 码友网首页 / 资讯源列表 / Testing Exceptions with xUnit and Actions

关于[Testing Exceptions with xUnit and Actions]的摘要:

When you're writing unit tests for a method, it's a good idea to test various failure conditions ("sad paths") in addition to testing the expected, everything is working condition ("happy path"). In particular, if you have a method that may throw exceptions, especially if they're custom domain exceptions, you should be sure you're testing this behavior. Another common source of exceptions is guard clauses, which are used to keep your method clean while ensuring its inputs adhere to the method's expectations.

原文地址: https://ardalis.com/testing-exceptions-with-xunit-and-actions/

收录时间: 2021-04-19 浏览量: 1675 分类: .NET

| 0 收藏 | 0