internal async Task GivenDeleteAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully() { // Arrange // Act var exception = await Assert.ThrowsAsync <NotImplementedException>( () => videoService.DeleteAsync(It.IsAny <Guid>())); // Assert exception.Should().NotBeNull().And.BeOfType <NotImplementedException>(); }
public void GivenDeleteAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully() { // Arrange // Act var exception = Assert.ThrowsAsync <NotImplementedException>( () => videoService.DeleteAsync(It.IsAny <Guid>())); // Assert Assert.That(exception, Is.Not.Null); Assert.That(exception, Is.TypeOf <NotImplementedException>()); }
public void GivenDeleteAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully() { // Arrange // Act var exception = Assert.ThrowsAsync <NotImplementedException>( () => videoService.DeleteAsync(It.IsAny <Guid>())); // Assert exception.ShouldNotBeNull(); exception.ShouldBeOfType <NotImplementedException>(); }
public async Task <ActionResult> DeleteVideo(int id) { try { await _videoService.DeleteAsync(id); return(GetSuccessResponse()); } catch (Exception exception) { return(GetErrorResponse(exception)); } }
public async Task <IActionResult> DeleteAsync([FromRoute] Guid id) { try { await videoService.DeleteAsync(id); return(NoContent()); } catch (ApplicationException) { return(NotFound()); } catch { return(BadRequest()); } }
public async Task <IActionResult> OnPostDeleteAsync(params long[] id) { await _service.DeleteAsync(id); return(JsonData(true)); }