internal async Task GivenCreateBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully() { // Arrange // Act var exception = await Assert.ThrowsAsync <NotImplementedException>( () => channelService.CreateBulkAsync(It.IsAny <IEnumerable <Channel> >())); // Assert exception.Should().NotBeNull().And.BeOfType <NotImplementedException>(); }
public void GivenCreateBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully() { // Arrange // Act var exception = Assert.ThrowsAsync <NotImplementedException>( () => channelService.CreateBulkAsync(It.IsAny <IEnumerable <Channel> >())); // Assert exception.ShouldNotBeNull(); exception.ShouldBeOfType <NotImplementedException>(); }
public void GivenCreateBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully() { // Arrange // Act var exception = Assert.ThrowsAsync <NotImplementedException>( () => channelService.CreateBulkAsync(It.IsAny <IEnumerable <Channel> >())); // Assert Assert.That(exception, Is.Not.Null); Assert.That(exception, Is.TypeOf <NotImplementedException>()); }
public async Task <IActionResult> CreateBulkAsync([FromBody] ICollection <Channel> channels) { try { await channelService.CreateBulkAsync(channels); return(Created("api/v1/channels", channels)); } catch { return(BadRequest()); } }