-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adicionando testes do controller de dominio
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |