public async Task GetUrlProjeto_BadRequest() { mockProjetoService.Setup(proj => proj.ObterUrlProjeto()).ReturnsAsync(string.Empty); CalculaController calculaController = new CalculaController(mockCalculaService.Object, mockProjetoService.Object); var result = await calculaController.GetUrlProjeto(); Assert.IsInstanceOf <BadRequestObjectResult>(result); }
public async Task GetUrlProjeto_Accepted() { mockProjetoService.Setup(proj => proj.ObterUrlProjeto()).ReturnsAsync("https://github.com/VandersonCardoso/CalculaJurosApi.git"); CalculaController calculaController = new CalculaController(mockCalculaService.Object, mockProjetoService.Object); var result = await calculaController.GetUrlProjeto(); Assert.IsInstanceOf <AcceptedResult>(result); }
public async Task GetUrlProjeto_ModelStateInvalid() { CalculaController calculaController = new CalculaController(mockCalculaService.Object, mockProjetoService.Object); calculaController.ModelState.AddModelError("Key", "errorMessage"); var result = await calculaController.GetUrlProjeto(); Assert.IsFalse(calculaController.ModelState.IsValid); Assert.IsInstanceOf <BadRequestObjectResult>(result); }