# 编写单元测试

> Write unit tests for your modules to identify and fix issues early in development.

对代码进行单元测试有助于在开发过程的早期识别和修复问题，确保代码按预期工作，并降低在模块中引入错误的风险。

| **主题**                                       | **描述**                                                    |
| -------------------------------------------- | --------------------------------------------------------- |
| [创建单元测试项目](./unit-testing-create-project.md) | 了解如何在 JetBrain Rider 或 Microsoft Visual Studio 中创建单元测试项目。 |
| [创建单元测试](./unit-testing-create.md)           | 参考示例了解如何为项目添加单元测试。                                        |

请参阅有关[创建第一个测试](https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-nunit#creating-the-first-test)的 Microsoft 文档，详细了解使用 `NUnit` 进行单元测试。
