Skip to content

Instantly share code, notes, and snippets.

@pazteddy
Created December 13, 2025 15:46
Show Gist options
  • Select an option

  • Save pazteddy/e3057b06297dafd088073e2f5eedb696 to your computer and use it in GitHub Desktop.

Select an option

Save pazteddy/e3057b06297dafd088073e2f5eedb696 to your computer and use it in GitHub Desktop.
Pruebas de Integración de Products con WebApplicationFactory
namespace DevTallesShop.Api.Tests.Integration;
public class ProductIntegrationTests : IAsyncLifetime
{
private CustomWebApplicationFactory _factory = null!;
private HttpClient _httpClient = null!;
public async Task InitializeAsync()
{
_factory = new CustomWebApplicationFactory();
_httpClient = _factory.GetHttpClient();
await Task.CompletedTask;
}
public async Task DisposeAsync()
{
_httpClient?.Dispose();
await _factory.DisposeAsync();
}
[Fact(DisplayName = "POST /products retorna el producto creado con ID asignado"), Skip = "Falta implementación")]
public async Task CreateProduct_ReturnsCreatedProductWithId()
{
}
[Fact(DisplayName = "POST /products valida payload JSON correcto")]
public async Task CreateProduct_ValidatesJsonPayload()
{
}
[Fact(DisplayName = "PUT /products/{id} debe retornar 200 OK cuando actualiza correctamente", Skip = "Falta implementación")]
public async Task UpdateProduct_ReturnsOkWhenSuccessful()
{
}
[Fact(DisplayName = "PUT /products/{id} debe retornar 404 cuando el producto no existe")]
public async Task UpdateProduct_ReturnsNotFoundWhenDoesNotExist()
{
}
[Fact(DisplayName = "DELETE /products/{id} debe retornar 204 No Content", Skip = "Falta implementación")]
public async Task DeleteProduct_ReturnsNoContent()
{
}
[Fact(DisplayName = "GET /products retorna headers correctos", Skip = "Falta implementación")]
public async Task GetAllProducts_ReturnsCorrectHeaders()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment