> For the complete documentation index, see [llms.txt](https://abi.gitbook.io/net-core/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://abi.gitbook.io/net-core/10.-pruebas-de-integracion/10.1-agregando-el-proyecto-de-pruebas-de-integracion.md).

# 12.2 Agregando el proyecto de pruebas de integración

Agregamos un nuevo **Proyecto de prueba de MSTest con (.NET Core)** en **C#,** tecleamos la palabra MSTest para buscarlo

Agrega un nuevo proyecto a tu solución, con el nombre CaducaRest.IntegrationTest.

![](/files/uDxlQUyYrqcPfUQGDjVN)

Selecciona .NET 6.0&#x20;

![](/files/CwZeq0U9xK4HdRzUoUyj)

Tecleamos el nombre CadudaRest.IntegrationTest y damos clic en Crear<br>

![](/files/PmFHIzdc8bDwWr7BHulH)

Te crea el proyecto de pruebas.&#x20;

Con MSTest a la clase que contiene las pruebas unitarias se le agrega el atributo **\[TestClass]** y a los métodos **\[TestMethod].**

{% code title="UnitTest1.cs" %}

```csharp
[TestClass]
public class UnitTest1
{
    [TestMethod]
    public void TestMethod1()
    {
    }
}
```

{% endcode %}

Agregamos la referencia de nuestro proyecto **CaducaRest** para obtener acceso a las clases de nuestros modelos.

Agregamos el paquete de **Microsoft.AspNetCore.App** el cual contiene todas las funciones para tokens, los archivos .resx para los mensajes de error, etc.

```
Install-Package Microsoft.AspNetCore.App 
```

Agregamos el paquete **Microsoft.AspNetCore.TestHost**, con este paquete podemos simular conectarnos a un servicio, lo utilizaremos para simular los mensajes de error.

```
Install-Package Microsoft.AspNetCore.TestHost 
```

Otro paquete que suele utilizarse es Moq, esto nos permite crear los objetos sustitutos de una forma fácil.

```
Install-Package Moq
```

Por último instalamos el paquete System.Text.Json el cual nos permite convertir un objeto en  Json o viceversa.

```
Install-Package System.Text.Json 
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://abi.gitbook.io/net-core/10.-pruebas-de-integracion/10.1-agregando-el-proyecto-de-pruebas-de-integracion.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
