Skip to content

Commit

Permalink
Adicionando testes do controller de dominio
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas229 committed Jun 29, 2023
1 parent 0aae199 commit f8d2a08
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/DominioControllerTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using app.Controllers;
using Microsoft.AspNetCore.Mvc;
using Moq;
using repositorio.Interfaces;
using Xunit;

namespace test
{
public class DominioControllerTest
{
[Fact]
public void ObterLista_QuandoMetodoForChamado_DeveRetornarListaDeUFs()
{
Mock<IUnidadeFederativaRepositorio> usuarioFederativaRepositorioMock = new();

var controller = new DominioController(usuarioFederativaRepositorioMock.Object);

var resultado = controller.ObterLista();

usuarioFederativaRepositorioMock.Verify(repo => repo.ObterDominio(), Times.Once);
Assert.IsType<OkObjectResult>(resultado);
}
}
}

0 comments on commit f8d2a08

Please sign in to comment.