internal async Task GivenDeleteBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully() { // Arrange // Act var exception = await Assert.ThrowsAsync <NotImplementedException>( () => channelService.DeleteBulkAsync(It.IsAny <IEnumerable <int> >())); // Assert exception.Should().NotBeNull().And.BeOfType <NotImplementedException>(); }
public void GivenDeleteBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully() { // Arrange // Act var exception = Assert.ThrowsAsync <NotImplementedException>( () => channelService.DeleteBulkAsync(It.IsAny <IEnumerable <int> >())); // Assert Assert.That(exception, Is.Not.Null); Assert.That(exception, Is.TypeOf <NotImplementedException>()); }
public async Task <IActionResult> DeleteBulkAsync([FromQuery] ICollection <int> ids) { try { await channelService.DeleteBulkAsync(ids); return(NoContent()); } catch (ApplicationException) { return(NotFound()); } catch { return(BadRequest()); } }