Пример #1
0
        public async Task Remove_not_ID_not_found()
        {
            //Arrange

            //Act
            var atributosController = new AtributosController(_logger.Object, _specification.Object, _repo.Object, _mapper.Object);
            var actionResult        = (NotFoundResult)await atributosController.DeleteAtributo(0);

            //Assert
            Assert.Equal(actionResult.StatusCode, (int)System.Net.HttpStatusCode.NotFound);
        }
        public async Task Remove_requestId_success()
        {
            //Arrange
            _mediatorMock.Setup(x => x.Send(It.IsAny <AtributosDeleteCommand>(), default(CancellationToken)))
            .Returns(Task.FromResult(true));

            //Act
            var atributosController = new AtributosController(_mediatorMock.Object);
            var actionResult        = (OkObjectResult)await atributosController.DeleteAtributo(120);

            //Assert
            Assert.Equal(actionResult.StatusCode, (int)System.Net.HttpStatusCode.OK);
        }
Пример #3
0
        public async Task Remove_requestId_not_found(int id)
        {
            //Arrange
            Atributo FakeAtributo = Build.CrearAtributo(500);

            _repo.Setup(repor => repor.GetElement(It.IsAny <ISpecification <Atributo> >()))
            .Returns(FakeAtributo);
            //Act
            var atributosController = new AtributosController(_logger.Object, _specification.Object, _repo.Object, _mapper.Object);
            var actionResult        = (NotFoundResult)await atributosController.DeleteAtributo(id);

            //Assert
            Assert.Equal(actionResult.StatusCode, (int)System.Net.HttpStatusCode.NotFound);
        }