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