public void TestPut_ReturnsBadRequestResultWhenEntityValidationException() { var toggle = new Toggle(); var mockOfIUpdateToggleCommand = new MockOfIUpdateToggleCommand(); mockOfIUpdateToggleCommand.SetupToThrowException( new EntityValidationException("")); var togglesController = new TogglesController(null, null, null, mockOfIUpdateToggleCommand.Object, null); IActionResult result = togglesController.Put(toggle.Id, toggle); Assert.IsInstanceOf <BadRequestObjectResult>(result); }
public void TestPut_ReturnsNotFoundResultWhenEntityNotFoundException() { var toggle = new Toggle(); var mockOfIUpdateToggleCommand = new MockOfIUpdateToggleCommand(); mockOfIUpdateToggleCommand.SetupToThrowException( new EntityNotFoundException(typeof(Toggle), toggle.Id.ToString())); var togglesController = new TogglesController(null, null, null, mockOfIUpdateToggleCommand.Object, null); IActionResult result = togglesController.Put(toggle.Id, toggle); Assert.IsInstanceOf <NotFoundObjectResult>(result); }