coderushforroslyn-118247-coding-assistance-code-templates-templates-for-unit-tests.md
This topic describes integrated templates that simplify writing unit tests.
Important
Visual Studio IntelliSense has priority over CodeRush templates. For information on how to prioritize a CodeRush template over Visual Studio IntelliSense , refer to the following topic section: Expand a Template Instead of Visual Studio IntelliSense.
CodeRush supports the following test frameworks:
Follow the steps below to write a test with CodeRush.
The t template expanded outside the class corresponds to the tf (test fixture) template. If you expand the t template inside the class, it calls the tm (test method) template that creates a new test method.
The table below shows templates for the most common assertions.
| Template | Description |
|---|---|
| ae | Assert Equality |
| as | Assert the Same |
| ans | Assert Not the Same |
| at | Assert True |
| af | Assert False |
| an | Assert Null |
| ann | Assert Not Null |
The screencast below shows the “ae” template expansion.
The set of templates depends on the testing framework. To see the full template list, refer to the Testing category in the Editor | All Languages | Templates options page. Use the CodeRush | Code Templates… menu item to access this options page.
See Also