Exemplo n.º 1
0
        public void PartialCommandUpdate_Returns404_WhenResourceNotExistsIdSubmitted()
        {
            _apiRepoMock.Setup(repo => repo.GetCommandById(0)).Returns(() => null);
            var controller = new CommandsController(_apiRepoMock.Object, _mapper);

            var actual = controller.PartialUpdateCommand(2, new JsonPatchDocument <CommandUpdateDto>());

            Assert.IsType <NotFoundResult>(actual);
        }
        public void PartialUpdateCommand_Returns404NotFound_WhenInvalidObjectProvided()
        {
            // Arrange
            mockRepository.Setup(repo => repo.GetCommandById(0)).Returns(() => null);
            var controller = new CommandsController(mockRepository.Object, mapper);

            // Act
            var result = controller.PartialUpdateCommand(0, new Microsoft.AspNetCore.JsonPatch.JsonPatchDocument <CommandUpdateDTO>());

            // Assert
            Assert.IsType <NotFoundResult>(result);
        }
        public void PartialUpdateCommand_Returns404NotFound_WhenNonExistentResourceIDSubmitted()
        {
            //Arrange
            mockRepo.Setup(repo => repo.GetCommandById(0)).Returns(() => null);
            var controller = new CommandsController(mockRepo.Object, mapper);

            //Act
            var result = controller.PartialUpdateCommand(0, new Microsoft.AspNetCore.JsonPatch.JsonPatchDocument <CommandUpdateDto>());

            //Assert
            Assert.IsType <NotFoundResult>(result);
        }