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>());
        }
예제 #3
0
        public void GivenDeleteAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully()
        {
            // Arrange

            // Act
            var exception = Assert.ThrowsAsync <NotImplementedException>(
                () => videoService.DeleteAsync(It.IsAny <Guid>()));

            // Assert
            exception.ShouldNotBeNull();
            exception.ShouldBeOfType <NotImplementedException>();
        }
예제 #4
0
        public async Task <ActionResult> DeleteVideo(int id)
        {
            try
            {
                await _videoService.DeleteAsync(id);

                return(GetSuccessResponse());
            }
            catch (Exception exception)
            {
                return(GetErrorResponse(exception));
            }
        }
예제 #5
0
        public async Task <IActionResult> DeleteAsync([FromRoute] Guid id)
        {
            try
            {
                await videoService.DeleteAsync(id);

                return(NoContent());
            }
            catch (ApplicationException)
            {
                return(NotFound());
            }
            catch
            {
                return(BadRequest());
            }
        }
예제 #6
0
        public async Task <IActionResult> OnPostDeleteAsync(params long[] id)
        {
            await _service.DeleteAsync(id);

            return(JsonData(true));
        }