Пример #1
0
        public async Task GetTaxaJuros_BadRequest()
        {
            mockTaxaService.Setup(taxa => taxa.ObterTaxaJuros()).ReturnsAsync(decimal.Zero);
            TaxaController taxaController = new TaxaController(mockTaxaService.Object);
            var            result         = await taxaController.GetTaxaJuros();

            Assert.IsInstanceOf <BadRequestObjectResult>(result);
        }
Пример #2
0
        public async Task GetTaxaJuros_Accepted()
        {
            mockTaxaService.Setup(taxa => taxa.ObterTaxaJuros()).ReturnsAsync(new decimal(0.01));
            TaxaController taxaController = new TaxaController(mockTaxaService.Object);
            var            result         = await taxaController.GetTaxaJuros();

            Assert.IsInstanceOf <AcceptedResult>(result);
        }
Пример #3
0
        public async Task GetTaxaJuros_ModelStateInvalid()
        {
            TaxaController taxaController = new TaxaController(mockTaxaService.Object);

            taxaController.ModelState.AddModelError("Key", "errorMessage");
            var result = await taxaController.GetTaxaJuros();

            Assert.IsFalse(taxaController.ModelState.IsValid);
            Assert.IsInstanceOf <BadRequestObjectResult>(result);
        }