Get a C# model

First of all, create a data model with the help of the C# Designer module. For more information about the creation of data models refer to the C# Designer user guide.

The following picture displays a simple example of data model created with C# Designer:

image

Generating the test model

Once you have got the elements in your C# model, you can generate the test from it. In order to do that, select the topmost C# package and then call "Create test model" under the "NUnit module" menu.

image

The NUnit Module will generate your test model. The "Generation report" window (see the picture below) will display the result of this generation. This window may contain several kinds of entries: Informations about the generation, Warnings for problems indicating that do not inhibit the generation of a valid test model, and Errors, for most serious problems that block the generation.

image

Notice that, in presence of generation warnings, code generated from the test model may be different from the expected one and may fail at compilation.

Adding the test model to the C# visual studio project

If no errors are detected, you may add the generated test model to the C# project. In order to do this:

  1. Create a Visual Studio project with the C# Designer module:

    image

  2. Select the created project and open it:

    image

  3. In Visual Studio, add a reference to the NUnit Framework:

    image

  4. Validate the dialog with "OK" button.

You are now ready to use NUnit in your project.

For more information on the use of visual studio projects in Modelio, refer to the C# Designer user guide.