Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }