public void DeleteToggleAsync_BadRequest() { var id = string.Empty; var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.DeleteToggle(id)); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = controller.DeleteToggle(id) as BadRequestResult; Assert.IsNotNull(responseActionResult); } }
public void DeleteToggleAsync_NotFound() { var id = "12345"; var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.DeleteToggle(id)).Throws(new ArgumentOutOfRangeException()); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = controller.DeleteToggle(id) as NotFoundResult; Assert.IsNotNull(responseActionResult); } }
public void DeleteToggleAsync_Ok() { var toggle1 = ToggleFakeData.GetToggleDto1(); var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.DeleteToggle(toggle1.Id)); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = controller.DeleteToggle(toggle1.Id) as OkResult; Assert.IsNotNull(responseActionResult); } }
public void DeleteToggleAsync_InternalServerError() { var id = Guid.NewGuid().ToString(); var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.DeleteToggle(id)).Throws(new NullReferenceException()); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = controller.DeleteToggle(id) as ExceptionResult; Assert.IsNotNull(responseActionResult); Assert.IsTrue(responseActionResult.Exception is NullReferenceException); } }