MbUnit Snippets
MbUnit ships with 15 C#\VB and 2 XML code snippets for use with Visual Studio as
follows. To install them,
- Open the Code Snippets Manager (Tools | Code Snippet Manager or Ctrl+K,B)

- Choose the language you want to add snippets for from the “Language”
dropdown menu at the top of the manager dialog.
- Click Add and navigate to the MbUnit installation directory. Open the VSSnippets
directory inside that.
- Select the folder containing the snippets for your language and click “Select
Folder”.
- Verify the snippets have been added by expanding the MbUnit*Snippets folder in
the manager dialog and selecting a few. Press OK when done.

Xml Snippets
There are 2 XML snippets included with MbUnit. To use them, use either Edit | Intellisense
| Insert Snippet or Ctrl+K, X.
- msbuild : Creates an empty MSBuild task to run MbUnit.
- nant : Creates an empty NAnt task to run MbUnit.
Note that in both cases, the XML calls custom tasks for MSBuild and nAnt which we’ve
developed for ease of use. Have a look at the
integrating MSBuild and
integrating nAnt pages for more on how to get these custom tasks working.
C# and Visual Basic Snippets
There are 15 code snippets for test writing, both in C# and VB. To use them, simply
type the name given below while in a VB or C# source file and press TAB twice.
- autorunner : Adds all the basic code for a simple
executable self-testing assembly.
- combinatorial : Adds code for a combinatorial test with 2 parameters
and 2 factories
- datafixture : Adds code for a data fixture test class
model : no longer valid
- processfixture : Adds code for a process fixture test class where
test are performed in a given order
- rowtest : Adds code for a simple row test
- state : Adds code for an IState wrapper
submodel : no longer valid
- test : Adds code for a simple test
- testexpectedexception : Adds code for a simple test that expects
an exception to be raised
- testfixture : Adds code for a basic fixture test class including
setup, teardown and test methods.
- testsuitefixture : Adds code for a test suite (dynamic) fixture
class and method to add tests to the suite at runtime
- typefixture : Adds code for a type fixture test class including
setup, teardown and test methods.
- typefixturefac : Adds code for a type fixture test class including
setup, teardown and test methods using a provider factory
- usingmbunit : Adds the standard using or imports statement for
MbUnit.Framework.
If you’d like to donate your own snippets to the team or suggest how to improve
the current ones, get in touch on the
MbUnit-Dev google group.