internal async Task GivenDeleteAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully()
        {
            // Arrange

            // Act
            var exception = await Assert.ThrowsAsync <NotImplementedException>(
                () => channelService.DeleteAsync(It.IsAny <int>()));

            // Assert
            exception.Should().NotBeNull().And.BeOfType <NotImplementedException>();
        }
Beispiel #2
0
        public void GivenDeleteAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully()
        {
            // Arrange

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

            // Assert
            exception.ShouldNotBeNull();
            exception.ShouldBeOfType <NotImplementedException>();
        }
        public void GivenDeleteAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully()
        {
            // Arrange

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

            // Assert
            Assert.That(exception, Is.Not.Null);
            Assert.That(exception, Is.TypeOf <NotImplementedException>());
        }
Beispiel #4
0
        public async Task <IActionResult> DeleteAsync([FromRoute] int id)
        {
            try
            {
                await channelService.DeleteAsync(id);

                return(NoContent());
            }
            catch (ApplicationException)
            {
                return(NotFound());
            }
            catch
            {
                return(BadRequest());
            }
        }
Beispiel #5
0
        public async Task <IActionResult> DeleteAsync(int id)
        {
            var exists = await _channelService.ExistsAsync(id);

            if (!exists)
            {
                return(NotFound());
            }

            var hasAdvertisements = await _channelService.HasAdvertisementsAsync(id);

            if (hasAdvertisements)
            {
                return(BadRequest());
            }

            await _channelService.DeleteAsync(id);

            return(Accepted());
        }
        public async Task <UnifyResponseDto> DeleteAsync(Guid id)
        {
            await _channelService.DeleteAsync(id);

            return(UnifyResponseDto.Success());
        }