Exemplo n.º 1
0
        public async Task E_Possivel_Invocar_a_Controller_Delete()
        {
            var serviceMock = new Mock <ICepService>();

            serviceMock.Setup(m => m.Delete(It.IsAny <Guid>())).ReturnsAsync(true);

            _controller = new CepsController(serviceMock.Object);

            var result = await _controller.Delete(Guid.NewGuid());

            Assert.True(result is OkObjectResult);
        }
        public async Task E_Possivel_Invocar_a_Controller_Delete()
        {
            var serviceMock = new Mock <ICepService>();

            serviceMock.Setup(c => c.Delete(It.IsAny <Guid>())).ReturnsAsync(true);

            _controller = new CepsController(serviceMock.Object);
            _controller.ModelState.AddModelError("Id", "Formato inválido");

            var result = await _controller.Delete(Guid.NewGuid());

            Assert.True(result is BadRequestObjectResult);
        }