# NUnit lisääminen VS2019

Alla kuvasarja Visual Studio 2019 työkalusta ja kuinka luoda siinä pohja testiprojektille. Lue kuvien sisällöt niin onnistut. Älä välitä kuvissa näkyvästä **käyttötilanteiden tallentimesta**, joka on lähinnä ohjelma joka kuvat on ottanut.

### Kuva 1. Luo ensin uusi Console App -projekti.

{% hint style="info" %}
Ei ole merkitystä, valitsetko projektityypin jossa lukee **.NET Core** tai **.NET Framework** kunhan on vain C# projekti.
{% endhint %}

![](/files/-LzcUpAir62oi93plspE)

### Kuva 2. Klikkaa hiiren oikealla Solution tiedoston päällä ja valitse Add > New Project

![](/files/-LzcUpAjZ0vfQE7K0AzM)

### Kuva 3. Valitse NUnit Test Project -projetityyppi

{% hint style="info" %}
Muista valita samanlainen projektityyppi kuin alussa eli **.NET Core** tai **.NET Framework**.
{% endhint %}

![](/files/-LzcUpAkYoAwzH3TKKYJ)

### Kuva 4. Nimeä ohjelma samoin kuin ensimmäinen projekti mutta lisää nimen loppuun Tests

![](/files/-LzcUpAYhDRDfbVJ_mCY)

### Kuva 5. Sinulla pitäisi olla kuvan Solution Explorer ikkunan mukaisesti kaksi eri projektia.&#x20;

![](/files/-LzcUpAdgYPwuM75UJCs)

### Kuva 6. Valitse "Test" valikosta "Test Explorer" kohta.

![](/files/-LzcUpAeKVQnx4m1J_5V)

### Kuva 7. Paina Run All Tests avautuvasta ikkunasta.

![](/files/-LzcUpAfpuNDy0KmD3ZP)

### Kuva 8. Jos testit ajamisen jälkeen näyttää vihreää niin hyvä.

![](/files/-LzcUpAgy2ZwMNPJS2yN)

### Kuva 9. Lopputilanne

Sinulla pitäisi olla Solution Explorer ikkunan mukaan kaksi projektia ja testit menevät läpi.&#x20;

Nyt projektipohja on valmis ja voit aloittaa harjoittelun.

![](/files/-LzcUpAhC4H6BBDNiyut)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.sovelluskontti.com/yksikkoetestaus/nunit-lisaeaeminen-vs2019.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
