Exemplo n.º 1
0
        public void DeleteCommand_Returns_404NotFound_WhenNonExistentResourceIDSubmitted()
        {
            //Arrange
            _mockRepo.Setup(repo =>
                            repo.GetCommandByID(0)).Returns(() => null);

            var controller = new CommandsController(_mockRepo.Object, _mapper);

            //Act
            var result = controller.CommandDelete(0);

            //Assert
            Assert.IsType <NotFoundResult>(result);
        }
Exemplo n.º 2
0
        public void DeleteCommand_Returns200OK_WhenValidResourceIDSubmitted()
        {
            //Arrange
            _mockRepo.Setup(repo =>
                            repo.GetCommandByID(1)).Returns(new Command {
                Id = 1, HowTo = "mock", Platform = "Mock", CommandLine = "Mock"
            });

            var controller = new CommandsController(_mockRepo.Object, _mapper);

            //Act
            var result = controller.CommandDelete(1);

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