public void DeleteNumber_WhenCalled_ReturnsNotFound(int id) { // Arrange service.Setup(x => x.Delete(id)) .Returns(false); mapper.Setup(x => x.Map <NumberServiceModel>(It.IsAny <NumberControllerModel>())) .Returns(numberService); // Act var result = numbersController.DeleteNumber(id); // Assert var response = result as StatusCodeResult; Assert.Equal(404, response.StatusCode); }
public void DeleteNumber_WhenCalled__ReturnsInternalError(int id) { // Arrange numbersController = new NumbersController(null, null, log.Object, query.Object); // Act var result = numbersController.DeleteNumber(id); Assert.IsType <StatusCodeResult>(result); // Assert var response = result as StatusCodeResult; Assert.Equal(500, response.StatusCode); }