I work on several projects where the unit testing framework may be the Visual Studio Test Framework, NUnit, or Xunit.  My preference lately has been using Xunit.  Out of the box CodeRush ships with templates that support NUnit the the MS Test framework, but not Xunit.  I needed to be able to use the same mnemonics for tests and not have to create new ones just for Xunit.  Here is how I accomplished it. 

  1. Goto the options for templates in CodeRush
    (DevExpress –> Options –> Editor –> Templates)
  2. Find the template (Nunit –> System –> #DependentNamepace#) and Create a duplicate of one of the expansions underneath. It really doesn’t matter which one.
  3. Select the expansion. Next we want to specify a context so this alternate expansion is only used inside an XUnit project. In the context picker at the lower right, place a green check in the Project\References checkbox (click it once).
  4. Right Click on References label and choose “Parameters”.  Type in Xunit.
  5. Down in the Dependent Namespaces, type in Xunit and apply

You will also do a similar process for the #TestMethodAttribute#.  For a quick video, please go to here.

Technorati Tags: ,